Salesforce Interview Question – Part 13


121 : Consider we have overall 90% code coverage however there is one class which have 0% code coverage. Can we still able to deploy that class on production?
Ans : Yes. Minimum 1% required for every trigger and there is no such restriction for Apex class.


122 : How to get selected records ID from List View using Javascript / Ajax Toolkit, when custom button is added on List View page?
Ans : Create a new Button on Lead of type List Button. Add the button on Lead List View Layout and write below Javascript code:

{!RequireScript("/js/functions.js")}

var recordsSelected = {!GetRecordIds($ObjectType.Lead)}
for(var i=0; i < recordsSelected .length ; i++) {
     alert('Selected ID '+recordsSelected[i]);
}

123 : In Ajax toolkit for custom Javascript button, you have to explicitly login to API because global Session variable is not available. In that case it is security vulnerable because anybody logged in can see the javascript code and your username and password. So is there any way to avoid this?
Ans: We can create a visualforce page with output type as JavaScript. Global session variable is available in VF page. Initialize the global javascript variable in that VF page. include VF page as a javascript file and we are done!


124 : In Custom Component How we can return value to Custom Controller or Controller Extension?
Ans: In Apex, Objects are passed by reference (read this article to understand Pass by Value and Pass by reference in Salesforce and also read this Salesforce blog article). So supply an argument of wrapper class (object) type to custom component. If its value is changed in Custom component we will get updated value in controller also.


125 : Lets consider you had created outbound changeset previously. After that, some class is modified which is part of that old changeset. Can you reuse same changeset to deployed changed component ?
Ans : Once changeset is created it cannot be modified. After creation of changset, if we modify any component it will not reflected and we need to clone the changeset to reflect changes. More information available here.


126 : We have a “Time Based Workflow” and there is Action scheduled to be executed. If we Deactivate the workflow, Scheduled actions will be removed from queue or not?
Ans : Even after deactivation of workflow, its action will be active in queue.


127 : We have “Time Based Workflow” and there is action scheduled to be executed. Can we delete that workflow?
Ans : If a workflow have any pending time dependent action, then we cannot delete the workflow.


128 : How to clear the Time based workflow action queue ?
Ans : Two ways to achieve this : 1. Make criteria false for all those records. 2. Navigate to “Set up | Monitoring | Time Based Workflow”, search for scheduled actions and remove from queue.


129 : In trigger, lets say we have system.debug() statement after adderror() method. Will system.debug() be statement executed in Trigger after adderror() method?
Ans: adderror() method is not error statement rather its normal execution flow and all the statements written after adderror() will be executed normally.


Related posts

6 thoughts on “Salesforce Interview Question – Part 13”

  1. Hi Jitender, can I have your contact details?
    Please give me a guidence regarding Impimentation of salesforce as a developer.
    I have full fledged knowledge on salesforce, but i dont know how to implement.

    Please guide me as Apex, Visualforce Development.

  2. ans 125 is wrong I believe. I have seen that change incorporates after creating change set till it gets uploaded to some other org.

Leave a Reply

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