• Raghavendra Sharma 12
  • NEWBIE
  • 20 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 7
    Questions
  • 2
    Replies
trigger deletes on parent__c (before delete) {
public set<id> h;
for(parent__c d:trigger.old)
{

h.add(d.name);
}

list<child__c> d=[SELECT name FROM child__c where link__c =: h ];
  
system.debug(d);
delete d;

}
Assignment​ ​#1
Usecase​ ​1-​ When a Opportunity is Closed with status ‘Won’’ then the Opportunity product and Quote line item must be synch with each other. Once sync is done, create a Order with proper details from Quote.Create Trigger, ApexClass and Test Class for the usecase.
Assume​ ​: 1. Opportunity is linked to Account and Contact.
2. Every opportunity can have only one quote as ‘Accepted’.
3. Won Opportunity may or may not have quote associated to it.


Assignment​ ​#2

Create the Apex trigger to assign the Branch Code to a Account wither its primary account or a Branch of Primary account. The Branch code will fallow a particular pattern.
Scenario 
The primary account Advanz101 will have a branch code set as 'Ad-1'.
● For every child branch will have branch code as 'Ad-11',Ad-'12','Ad-13' for branch 1,2,3 respectively.
● IF the child branch for branch 1 (Ad-11) has sub child branch then the branch code will be (Ad-111),and second child branch will have (Ad-112)
● Create a Apex trigger on Account which will update the text field Branch code on account depending on Parent account.