Salesforce Interview Questions – Part 22

220+ Salesforce Interview Questions
220+ Salesforce Interview Questions

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 :

List<Contact> lstContact = new List<Contact>();
Contact con = new Contact (lastName = 'Zaa', SQL_Server_Id__c='3',firstName='Jitendra');
lstContact.add(con);
//.. Other Contact records added in List
Database.UpsertResult[] results = Database.upsert( lstSGAccOppInsert, Contact.SQL_Server_Id__c.getDescribe().getSObjectField() ,false ) ;

for(Integer i=0;i<results.size();i++){
    if (!results.get(i).isSuccess()){
        Database.Error err = results.get(i).getErrors().get(0);
        System.debug('Error - '+err.getMessage() + '\nStatus Code : '+err.getStatusCode()+'\n Fields : '+err.getFields());
    }
}

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”.


Posted

in

by

Comments

4 responses to “Salesforce Interview Questions – Part 22”

  1. Radnip Avatar
    Radnip

    So what custom fields end __s ?

    I think my answer to “While creating JavaScript button to execute anonymous apex, what should you keep in mind ?” would be why are you creating a javascript button to execute anonymous apex in the first place when it won’t work in lightning UI / mobile etc…

    1. Jitendra Zaa Avatar

      That’s nice suggestion, I will add it. Scenario for sometimes we need JS button to execute apex – We have some utility method which performs operation from Scheduler however, lets say user is on record and they want to force that logic to run. we can simply call existing Apex method from JS so that user doesn’t need to wait for schedule time, something like correcting Apex based sharing or syncing data with external webservice. Understand that Salesforce team is removing AJAX button from lightning coz of security issue but its really very useful in many scenarios.

      1. Radnip Avatar
        Radnip

        Yup they even removed javascript from flow when it first came out. Personally I would try everything I could not to use a javascript button. Using process builder to call apex, publisher action… but have to say there is still a bit of a gap. I’m considering at the moment maybe even creating lightning components within Visualforce on the page layout. At least then its “Lightning ready”.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.