Parul
IndividualForum Replies Created
-
Parul
MemberSeptember 20, 2018 at 6:07 pm in reply to: What reduce(function) will do in component.find() in Salesforce Lightning?Hi,
reduce() is javaScript array method, actually this is the syntax of this method :
syntax : array.reduce(function(total, currentValue, currentIndex, arr), initialValue)
In your scenario it will return field value from given field in InpCmp.
-
Parul
MemberSeptember 20, 2018 at 6:05 pm in reply to: How To Get The List Of All Available Sobject In Salesforce Database Using Apex (dynamic Apex)?Map<String, Schema.SObjectType> m = Schema.getGlobalDescribe() ;
Schema.SObjectType s = m.get('API_Name_Of_SObject') ;
Schema.DescribeSObjectResult r = s.getDescribe() ;
Map<String,Schema.SObjectField> fields = r.fields.getMap() ;Try this code to get all fields dynamically.
Thanks
-
Parul
MemberSeptember 20, 2018 at 6:02 pm in reply to: present validation error under inputtext field in SalesforceHi,
You can use following code in your apex controller to get error message to respective field.
ObjectInstance.FieldName.AddError('Your Error message')
for example if you have contact object and you want to display error message in lastName field then you can do like following
Contact con = new contact();
con.LastName.addError('Please fill contact Name');
-
Parul
MemberSeptember 20, 2018 at 5:59 pm in reply to: What Is Difference In Render, Rerender And Renderas Attributes Of Visualforce?Render: – Is used to show/hide the particular block, output panel or input/output fields based on the condition.
rendered= “true or flase”
Rerender Attribute:–
Rerender Attribute is used to refresh particular section on page to update latest data received from salesforce after action method call is done. You need to give the id of page section in attribute as shown below
rerender = “pageblockId”
Renderas Attribute:–
If you want to render your page as PDF, so this is the right option to go ahead with it and most importantly only PDF is the supported content converter. Setting this Renderas attribute to “pdf” renders the page as a PDF.
Renderas= “pdf”
Thanks
-
Parul
MemberSeptember 20, 2018 at 5:57 pm in reply to: How To Get The List Of All Available Sobject In Salesforce Database Using Apex (dynamic Apex)?Try this code snippet:
public class ControllerClassName
{
public List<String> strList { get;set; }public void autoRun()
{
Map<String, Schema.SObjectField> objectFields = Schema.getGlobalDescribe().get('Account').getDescribe().fields.getMap();strList = new List<String>(objectFields.keySet());
}
}Thanks
-
Parul
MemberSeptember 20, 2018 at 5:56 pm in reply to: How to get the list of all available sobject in salesforce database using Apex (Dynamic Apex) ?public class ControllerClassName
{
public List<String> strList { get;set; }public void autoRun()
{
Map<String, Schema.SObjectField> objectFields = Schema.getGlobalDescribe().get('Account').getDescribe().fields.getMap();strList = new List<String>(objectFields.keySet());
}
}Try this
Thanks
-
Parul
MemberSeptember 20, 2018 at 5:56 pm in reply to: What is the difference between Formula fields and Roll Up Summary Fields in Salesforce?Hi,
A roll-up summary field calculates values from related records, such as those in a related list. You can create a roll-up summary field to display a value in a master record based on the values of fields in a detail record. The detail record must be related to the master through a master-detail relationship. For example, you want to display the sum of invoice amounts for all related invoice custom object records in an account’s Invoices related list. You can display this total in a custom account field called Total Invoice Amount.
where as formula field is a read only field, the value of formula filed evaluate from expression defined by us. If we update any value in the expression, it automatically updates formula field value. We can create formula fields in both standard and custom object.
-
Parul
MemberSeptember 20, 2018 at 5:55 pm in reply to: What Happens If Child Have Two Master Records And One Is Deleted?A master-detail relationship is a stricter relationship, where the children (detail records) are tied to the parent (master). They can't be moved to another master (yet - this is coming soon) and deleting the master will delete all of it's children.
Thanks
-
Parul
MemberSeptember 20, 2018 at 5:49 pm in reply to: What are the field datatypes that can be used as external IDs in Salesforce?Hi,
Salesforce allows you select up to 3 fields as External IDs and these fields must be text, number or email field types. Values in these External ID field must also be unique and you can also determine whether or not value are case sensitive.
-
Parul
MemberSeptember 20, 2018 at 5:45 pm in reply to: How Validation Rules Executed? Is It Page Layout / Visualforce Dependent?I think it's a data model level, so that are not affected by UI.
Thanks
-
Parul
MemberSeptember 20, 2018 at 5:30 pm in reply to: How Many Controllers Can Be Used On Single Vf Page?We can use only one controller can be used salesforce. Other than them, Controller extension can be used. There may be more than one Controller extention.
Thanks
-
Parul
MemberSeptember 20, 2018 at 5:20 pm in reply to: How to get the picklist value in Salesforce Apex class?Hi,
Using Dynamic apex, we can achieve this. On object of type pickilist, call getDescribe(). Then call the getPicklistValues() method. Iterate over result and create a list. Bind it to <apex:selectOptions>.
Code Example:
Let’s say we have a custom object called OfficeLocation__c. This object contains a picklist field Country__c.
The first thing we need to do, within our controller is use the getDescribe() method to obtain information on
the Country__c field:
Schema.DescribeFieldResult fieldResult = OfficeLocation__c.Country__c.getDEscribe();
We know that Country__c is a picklist, so we want to retrieve the picklist values:
List<Schema.PicklistEntry> ple = fieldResult.gerPicklistValues();
The only thing left for us to do is map the picklist values into an <apex:selectOptions> tag can use for display. Here is the entire method from our controller to do this:
public List<SelectOption> getCountries() { List<SelectOption> options = new List<SelectOption>(); Schema.DescribeFieldResult fieldResult = OfficeLocation__c.Country__c.getDescribe(); List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues(); for(Schema.PicklistEntry f : ple) { options.add(new SelectOption(f.getLabel(), f.getValue())); } return options; }
With our controller logic all complete, we can call the getCountries() method from our Visualforce page, and populate the <apex:selectList> tag:
<apex:selectList id=”countries” value=”{!Office_Location__c.Country__c}” size=”1″ required=”true”> <apex:selectOptions value=”{!countries}”/> </apex:selectList>
Thanks
-
Parul
MemberSeptember 20, 2018 at 5:19 pm in reply to: How To Get The Picklist Value In Apex Class?Adding code snippet:
This is very simple. I am sharing some code ,please go through this
Here is My Controllerpublic class testclass { public Job__c job{get;set;} public List<SelectOption> options{get;set;} public testclass(){ options = new List<SelectOption>(); Schema.DescribeFieldResult fieldResult = Job__c.Status__c.getDescribe(); List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues(); for( Schema.PicklistEntry f : ple) { options.add(new SelectOption(f.getLabel(), f.getValue())); } } }
My Page
<apex:page controller=”testclass“> <apex:form> <apex:pageBlock> Order Status:<apex:selectList id=”countries” value=”{!job.Status__c}” size=”1″ required=”true” > <apex:selectOptions value=”{!options}”/> </apex:selectList> </apex:pageBlock> </apex:form> </apex:page>
Thanks.
-
Parul
MemberSeptember 20, 2018 at 5:18 pm in reply to: What are the types of Controller in Salesforce Visualforce?Adding points:
A custom controller is an Apex class that implements all of the logic for a page without leveraging a standard controller. Use custom controllers when you want your Visualforce page to run entirely in system mode, which does not enforce the permissions and field-level security of the current user.
A controller extension is an Apex class that extends the functionality of a standard or custom controller. Use controller extensions when: You want to leverage the built-in functionality of a standard controller but override one or more actions, such as edit, view, save, or delete.
You want to add new actions.You want to build a Visualforce page that respects user permissions. Although a controller extension class executes in system mode, if a controller extension extends a standard controller, the logic from the standard controller does not execute in system mode. Instead, it executes in user mode, in which permissions, field-level security, and sharing rules of the current user apply.
If you want your page to have the standard behaviors that are provided by Salesforce than you will be using Standard Controllers. Salesforce Provided standard controllers for most of the standard and custom objects.
Thanks
-
Parul
MemberSeptember 20, 2018 at 5:17 pm in reply to: In Which Scenario Share Object “mycustomobject__share” Is Not Available/created For Custom Object ?Adding some code snippet:
There are a couple of reasons why there might not be a share object. First of all, if you have created a Master-Detail relationship on the entity, it disables sharing for that entity, since visibility is controlled by the parent. In this case, you would also notice that the Owner field is missing, since the owner can never be changed, and will always be considered the owner of the parent record. Secondly, it may be that your entity is in Public Read/Write mode. Sharing is only enabled for entities that are not globally accessible (i.e. they must be Read-only or Private).
Please check Setup > Security Controls > Sharing Settings for this entity's configuration.
Thanks
-
Hi
On the record detail page, click the link to change the owner.If you don’t see the link, you don’t have permissions to change record ownership.
Enter or select a new owner. In organizations where the Salesforce Customer Portal or partner portal is enabled, you can filter the results that appear on the user lookup dialog. Select either a queue or group of users from the Owner orAssigned To drop-down list.To notify the new owner, select the Send Notification Email checkbox.The “From” email address displayed in the notification is your return email address set in your email settings.
For cases in Professional, Enterprise, Unlimited, Performance, and Developer Edition organizations, the Case Assigned Template setting specified in Support Settings determines the email text. For other records, the email text is generated automatically and cannot be customized.
Depending on your user permissions and the type of object you’re transferring, you can select which related items to transfer.
Save your changes.Thanks
-
Parul
MemberSeptember 20, 2018 at 5:13 pm in reply to: Why Keyword “without Sharing” Is Introduced In Salesforce Apex?Without Sharing is reserved for cases where the User does not have access to the records, but there is a need to update them based on user input.
Use the without sharing keywords when declaring a class to ensure that the sharing rules for the current user are not enforced. For example, you may want to explicitly turn off sharing rule enforcement when a class acquires sharing rules when it is called from another class that is declared using with sharing.
public without sharing class noSharing {
// Code here}
Thanks
-
Parul
MemberSeptember 20, 2018 at 5:11 pm in reply to: What is the need of “Custom Controller” in Visualforce as everything can be done by the combination of Standard Controller + Extension class in salesforce?Hi
1) Sharing setting is applied on standard object or extension by default, In case we don’t want to apply sharing setting in our code then Custom controller is only option.
2) A custom controller is an Apex class that implements all of the logic for a page without leveraging a standard controller. Use custom controllers when you want your Visualforce page to run entirely in system mode, which does not enforce the permissions and field-level security of the current user.
Thanks
-
Parul
MemberSeptember 20, 2018 at 5:11 pm in reply to: What Is The Need Of “custom Controller” In Visualforce ?1) Sharing setting is applied on standard object or extension by default, In case we don’t want to apply sharing setting in our code then Custom controller is only option.
2) A custom controller is an Apex class that implements all of the logic for a page without leveraging a standard controller. Use custom controllers when you want your Visualforce page to run entirely in system mode, which does not enforce the permissions and field-level security of the current user.
-
Parul
MemberSeptember 20, 2018 at 4:55 pm in reply to: How To Force Lead Assignment Rule Via Apex While Updating Or Adding The Lead?Adding some code snippet:
AssignmentRule AR = new AssignmentRule();
AR = [select id from AssignmentRule where SobjectType = 'Lead' and Active = true limit 1];//Creating the DMLOptions for "Assign using active assignment rules" checkbox
Database.DMLOptions dmlOpts = new Database.DMLOptions();
dmlOpts.assignmentRuleHeader.assignmentRuleId= AR.id;Lead newLead = new Lead(Status = 'New') ;
//Setting the DMLOption on Lead instance
newLead.setOptions(dmlOpts);
insert newLead ;Thanks
-
If you are using Lightning then you can use javascript in your lightning bundle in a js file. In init function of the component to remove the autofocus.
Thanks
-
Parul
MemberSeptember 20, 2018 at 4:45 pm in reply to: How To Write The “where” Clause In Soql When Group By Is Used in Salesforce?Adding some points:
SELECT * FROM `movies` GROUP BY `category_id`,`year_released` HAVING `category_id` = 8;
The GROUP BY Clause is used to group rows with same values .
The GROUP BY Clause is used together with the SQL SELECT statement.
The SELECT statement used in the GROUP BY clause can only be used contain column names, aggregate functions, constants and expressions.
The HAVING clause is used to restrict the results returned by the GROUP BY clause.Thanks
-
Adding some points
The expression cannot include Aggregate Functions; however, the GROUP BY clause is often used with Aggregate Functions to return summary values for eachgroup. The GROUP BY clause without aggregates is similar to using SELECT DISTINCT. ... The GROUP BY clause does not order data.
Thanks
-
Parul
MemberSeptember 20, 2018 at 4:30 pm in reply to: How To Display The Formatted Number / Date In Visual Force? Which Component Should Be Used?Adding code snippet
<apex:page controller="DmVFcheck_CC" >
<apex:form><apex:inputField value="{!evento.StartDateTime}" >
<apex:actionSupport event="onchange" action="{!functionName}" reRender="renderOp1"/>
</apex:inputField>
<apex:outputPanel id="renderOp1"><apex:outputText value="{0, date,dd MMMM yyyy}">
<apex:param value="{!evenDate}" />
</apex:outputText></apex:outputPanel>
</apex:form>
</apex:page> -
Parul
MemberSeptember 20, 2018 at 4:26 pm in reply to: If Ie9 Is Not Working With Your Custom Visualforce PageAdding some points
Firstly, you might be able to add the following meta tag to your pages:
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" />
This will tell IE9 that you would prefer it operate like IE8, and IE8 still works fine. However, I believe this meta tag needs to be one of the first things declared in the page, and under some situations (like showHeader=true) you may not have control over that. In that case, you can add the following to the Apex controller:
Apexpages.currentPage().getHeaders().put('X-UA-Compatible', 'IE=8');
Thanks