Scenario :- Write a code to implement following requirement.When Account is created, give access to the users who belong to a Queue to work on account and its related opportunity. Solution :- Here we will use the concept of accountteammember to provide account access to other users who are going to work on it. Apex… Continue reading Coding Scenario 18 — Account Team Members
Tag: interview question
Coding scenario in salesforce – 8
Write a code to keep account and opportunity owner in-sync Scenarios When opportunity is created, set owner id as related account owner id. trigger opportunityDemotrigger on Opportunity (before insert) { if(trigger.isbefore){ if(trigger.isinsert){ set<id> relatedaccountIds = new set<id>(); for(opportunity opp : trigger.new){ relatedaccountIds.add(opp.accountId); } map<id,account> accMap = new map<id,account>([select id,ownerid from account where id IN :relatedaccountIds]);… Continue reading Coding scenario in salesforce – 8
Coding scenario 7 || Salesforce Practice Question
Question :- Write logic to update maximum amount checkbox on opportunity based on amount on insert or update of opportunity. Answer :- trigger opportunityTrigger on Opportunity (before insert, before update) { if(trigger.isbefore){ if(trigger.isinsert){ set<id> accountIds = new set<id>(); map<id,opportunity> existingmaxOpp = new map<id,opportunity>(); for(opportunity opp : trigger.new){ accountIds.add(opp.AccountId); } //map of account with existing opportunity… Continue reading Coding scenario 7 || Salesforce Practice Question