Skip to main content
Interview Question on Triggers

1) What the are events of triggers?
- After insert,After Update & After Delete

2) Upsert trigger can call which all events?
-After Update & After Insert

3) What is merge operation?

4) Which events will be called during merger operation?
- Ans Delete n Update

5) In After Undelete, we cannot see trigger.old, only trigger.new can be seen.True or False?
       -TRUE

6) Static variable declarion in trigger is possible,True or false?
     -TRUE but it will not work.

7) In After update trigger event to Save a record do we need DML statement?
- Yes

8) In before insert trigger event can we have trigger.new and trigger.newmap?
- we can only have trigger.new, Trigger.newmap is not possible because still the record is not inserted             and record Id is not generated.

9) Can we have batch/asynchronous method called from a Trigger?
- YES

10) Can we manually call triggers?
- No triggers cannot be called manually. It will automatically called for Insert/delete/update DML        
          operations only.

11) Can we write trigger for Profile object?
- No, generally there will be no scenarios to call trigger on Profile Object.

12) Will trigger fire after Workflow rule?
-Only Update triggers will fire once.

13) You have picklist field with 3 values :New, Latest,Old. Now you fire a trigger which will update the picklist field with 'Deleted' value for a record. Is this possible?
- YES

14) Can you update formula field through Trigger?
- NO

15) I need to update Trigger.Old records how can i do this?
- This is not possible because Trigger.Old is read only list.

16) Can we display Validation Error messages in After events of a Trigger?
- We Can display Error messages in After events, but there will be no purpose serverd. Because after inserting/Updating the record the error message will be dispalyed.

17)Consider a User logsin by a profile which does not have eidt access to Account object. But he/she tries insert a record to Account object, which in turns fires a trigger which updates  record in the Account Object.
Will the Trigger Update the Record?
- Yes the Trigger can update the Record because Trigger always runs is System context.






Interview Question on Triggers

1) What the are events of triggers?
- After insert,After Update & After Delete

2) Upsert trigger can call which all events?
-After Update & After Insert

3) What is merge operation?

4) Which events will be called during merger operation?
- Ans Delete n Update

5) In After Undelete, we cannot see trigger.old, only trigger.new can be seen.True or False?
       -TRUE

6) Static variable declarion in trigger is possible,True or false?
     -TRUE but it will not work.

7) In After update trigger event to Save a record do we need DML statement?
- Yes

8) In before insert trigger event can we have trigger.new and trigger.newmap?
- we can only have trigger.new, Trigger.newmap is not possible because still the record is not inserted             and record Id is not generated.

9) Can we have batch/asynchronous method called from a Trigger?
- YES

10) Can we manually call triggers?
- No triggers cannot be called manually. It will automatically called for Insert/delete/update DML        
          operations only.

11) Can we write trigger for Profile object?
- No, generally there will be no scenarios to call trigger on Profile Object.

12) Will trigger fire after Workflow rule?
-Only Update triggers will fire once.

13) You have picklist field with 3 values :New, Latest,Old. Now you fire a trigger which will update the picklist field with 'Deleted' value for a record. Is this possible?
- YES

14) Can you update formula field through Trigger?
- NO

15) I need to update Trigger.Old records how can i do this?
- This is not possible because Trigger.Old is read only list.

16) Can we display Validation Error messages in After events of a Trigger?
- We Can display Error messages in After events, but there will be no purpose serverd. Because after inserting/Updating the record the error message will be dispalyed.

17)Consider a User logsin by a profile which does not have eidt access to Account object. But he/she tries insert a record to Account object, which in turns fires a trigger which updates  record in the Account Object.
Will the Trigger Update the Record?
- Yes the Trigger can update the Record because Trigger always runs is System context.






Comments

Popular posts from this blog

SFDC scenario based interview Questions

1) Consider this scenario I  have a profile  by name 'ProvideReadAccess' and two users U1 and U2 assigned to it. And I have object X. My Question is I want to have ReadWrite access for U1 and ReadOnly access for U2  for the object X. How do I do this? Answer: Read Access for both users is common hence in the Profile settings give 'Read' access for the object 'X' By doing this User U2 will be able to read all the records( One condition satisfied) but U1 will also be able to only read the records(Second condition not satisfied). So next what do we do is we create a permission set say 'GrantWriteAccess' and in this permission set we give the object 'X' the Write access and assign the user U1 to this permission set.(2nd condition satisfied). Explanation about when and where to use permission set and profile https://success.salesforce.com/answers?id=90630000000grVPAAY 2) Consider a scenario I have not given any CRUD...

Custom Labels

Can we have multiple values in Custom Labels. Yes, Salesforce supports multiple values in custom Labels. How to implement that ? Create a New custom label and provide Multiple values with comma ( , ) separated. Example:   Custom Label Name: School Values: Test,Exam,Tutions How to access this Custom Label in Apex controller / Class file Syntax: System.Lable.CustomLabelName Example:System.Label.School How to access this Custom Label in Visualforce page Syntax: !$Label.CustomLabelName Example: !$Label.School How do we check if TempString is present in the custom label in a controller ? Syntax: System.Label.CustomLabelName.Contains(value) Example: System.Label.School.contains(TempString) How do we check if TempString is present in the custom label in a visualforcepage? Syntax: CONTAINS($Label.CustomLabelName,TextValue) Example: CONTAINS($Label.School,"Text")