anusha(salesforce developer)

configarationQ&A

121. How to create lookup field in Salesforce flow?
Ans : There is no direct way to create a lookup field in flow but we can use workaround mentioned in this post.

122 : How to handle fault in Salesforce flow?
Ans :
 We can send emails or fault screen can be created. If any element is connected to second screen, it automatically becomes fault screen and we can use “$Flow.FaultMessage” on screen to show error message. output text can be added on screen with message something like “Sorry, an error occurred in the page. For help, provide your administrator with the following information: {!$Flow.FaultMessage}”. Read more here.

123 : How to redirect Salesforce flow after completion, if end URL is known in advance?
Ans :

There are two approach :
First by using “retURL” parameter in URL of flow
and second,  if flow is used in Visualforce page then
1<apex:page>
2    <flow:interview name="MyUniqueFlow" finishLocation="{!$Page.MyUniquePage}"/>
3</apex:page>
4or
5<apex:page>
6    <flow:interview name="MyUniqueFlow" finishLocation="{!URLFOR('/home/home.jsp')}"/>
7</apex:page>

124 : What are difference between lookup and fast lookup data elements in flow?
Ans :
 Lookup record will return only first matching record however to get all matching record, we should use fast lookup. Any data element with prefix “fast” means to work in bulk. As shown in below image we have two flavors of Data element in flow for CRUD operation.
Salesforce Flow Data Elements
Salesforce Flow Data Elements

125: What is use of loop element in Salesforce flow ?
Ans :
 Loop element in Salesforce flow is used to iterate elements in collection. You can compare it with “for or while” loops in programming language. Below image shows sample of flow, which uses Loop element to mass update lead records by changing some value iteratively using loop element. You can check this YouTube video as well to see it in action.
Sample Salesforce flow using loop element
Sample Salesforce flow using loop element

126: Which interface needs to be implemented in Apex to be used in Flow ?
Ans :
 We can execute apex as well using flow by annotating it with “@InvocableMethod” and marking method as static. However this method only takes one parameter of type list. If we want to send multiple parameters, then simplest way is to create comma separated list of argument and pass it. In this method, we can break it and use according. Below is sample code
1Global class Flow_UpdateAccountField {   
2    @InvocableMethod
3    public static void performUpdate(List<String> lstCSV){
4        List<String> recIds = lstCSV[0].split(',');
5        //0 - AccId, 1-field1__c
6        Account acc = new Account(Id=recIds[0], field1__c=recIds[1]);
7        update acc;       
8    }
9 
10}

127 : How to create non mandatory dropdown field in Salesforce flow ?
Ans : We cannot create non mandatory dropdown field in flow (at time of writing this). However there is simple workaround as explained in this post.

128 : How to create two columns page layout in Salesforce Flow ?
Ans :
 We cannot create two column page layout in Salesforce flow (at time of writing this post). However we can use workaround explained in this post.

129 : How to set finish location of Salesforce Flow for newly created record inside flow ?
Ans :
 Currently there is no way to set finish location of Salesforce flow by point and click or Visualforce. We have to write Apex controller or controller extension to achieve this. Below is sample code.
Visualforce code:
1<apex:page standardController="Account" extensions="Flow_redirect_finish"
2    <flow:interview name="Create_Contact" interview="{!contactFlow}" finishlocation="{!NewRecordId}">
3        <apex:param name="varAccountId" value="{!$CurrentPage.parameters.parameter1}"/>
4        <apex:param name="varCallLogId" value="{!$CurrentPage.parameters.parameter2}"/>
5    </flow:interview>
6</apex:page>
Apex code :
1public class Flow_redirect_finish {
2    private Account objAcc ;
3    public Flow.Interview.Create_Contact contactFlow { get; set; }
4     
5    //Constructor for Controller extension
6    public Flow_redirect_finish(ApexPages.StandardController stdController){
7        objAcc = (Account)stdController.getRecord();
8    }
9     
10    private String readFlowVariable() {
11        if (contactFlow == nullreturn '';
12            else return contactFlow.varContactId;
13    }
14     
15    public PageReference getNewRecordId(){
16        return new PageReference('/' + readFlowVariable() );
17    }
18}

130 : How to create Dependent Picklist ?
Ans : Dependent picklist cannot be created in Salesforce flow. However there is work around. Lets say, if we need dependent picklist of level 3, like first select “country” and then “state” and then “city”, then we will need three screen. We can take help of Custom object, Custom setting or Custom Metadata types as discussed in this blog post.
211 : While creating JavaScript button to execute anonymous apex, what should you keep in mind ?
Ans : End user must needs to have “Apex Author” permission and this is something should not be granted to end user. Also, while creating JavaScript button, user must be aware that its only supported in Salesforce classic and not in Salesforce Lightning.

212 : How to enable truncate custom object feature in Salesforce ?
Ans : Navigate to “App Setup | User Interface” and select “Enable Custom Object Truncate”.

213 : What may be reason truncate button is not visible on Custom Object ?
Ans :
  • Are referenced by another object through a lookup field or that are on the master side of a master-detail relationship
  • Are referenced in a reporting snapshot
  • Have a custom index or an external ID

214 : How to report on User License field?
Ans :
Create formula field in User Object with formula “Profile.UserLicense.Name”.
Note: You need to copy and paste this value because it doesn’t show up in the fields drop down.

215 : Which custom fields or relationships in salesforce ends with “__pc” and “__pr” ?
Ans : In normal scenario all custom fields ends with “__c” and relationships ends with “__r” However for Person accounts, custom fields ends with “__pc” and custom relationship ends with “__pr”.

216 : Difference between Chatter API and Connect API.
Ans :
  • Chatter API is REST API for Chatter to display Salesforce data, especially in mobile applications. Responses are localized, structured for presentation, and can be filtered to contain only what the app needs.
  • Connect API provides apex classes for accessing the same data available in Chatter REST API. Use Chatter in Apex to create custom Chatter experiences in Salesforce.

217 : How to capture errors after using Database DML methods in Salesforce?
Ans :
1List<Contact> lstContact = new List<Contact>();
2Contact con = new Contact (lastName = 'Zaa', SQL_Server_Id__c='3',firstName='Jitendra');
3lstContact.add(con);
4//.. Other Contact records added in List
5Database.UpsertResult[] results = Database.upsert( lstSGAccOppInsert, Contact.SQL_Server_Id__c.getDescribe().getSObjectField() ,false ) ;
6 
7for(Integer i=0;i<results.size();i++){
8    if (!results.get(i).isSuccess()){
9        Database.Error err = results.get(i).getErrors().get(0);
10        System.debug('Error - '+err.getMessage() + '\nStatus Code : '+err.getStatusCode()+'\n Fields : '+err.getFields());
11    }
12}

218 : What causes Concurrent Apex limit error in Salesforce ?
Ans : If Synchronous Apex runs more than 5 sec it considered as long running job. And we have limit that only 10 long running job can execute at a time. So, whenever 11th Synchronous apex tries to execute, it gets Concurrent Apex limit error. Read more here about Concurrent Request Limits

219. What is custom metadata type ?
Ans :
 Custom metadata was introduced generally in Summer 15 release. Before Custom metadata type, we were using Custom settings of List type. Problem with custom setting was that, during migration or in packages, data were not migrated. We had to either use data loader or some API to create initial data. However, if we package custom metadata type or migrate it, data will also be migrated along with it.

220. Which component in Salesforce ends with “__mdt” and “__s”?
Ans :
 Custom metadata types ends with “__mdt” (meta data type), just like custom object or custom fields ends with “__c”.
When we create Geolocation field in Salesforce, lets say by name “location__c” then internally Salesforce creates subfields with extension “__s“. In this case “location_latitude__s” and “location_longitude__s”.

No comments:

Post a Comment