- Q I'm going to do add disks to my asm diskgroup, how long will this rebalance take?
- Q What is the main ore of aluminium
- Q What is the option specified in the read operation to gain multiple concurrent operations on the same dataset?
- Q International aircraft registration letters what country is PP or PT
- Q Why is _jspservice() method starting with an '_' while other life cycle methods do not?
- Q To whom does the Public Accounts Committee submit its report?
- Q How 70% alcohol works as disinfectant?
- Q What is a Transactional Log Database Backup type in SQL?
- Q What cranial nerves are commonly involved in an acoustic neuroma?
- Q What's the difference between fgetpos/fsetpos and ftell/fseek?
- Q Yvon Petra was the last man to do what at Wimbledon
Question
When do you use a before vs. After trigger?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Management,
Answers
95% of triggers are before triggers – so if you’re unsure, go with before!
You may be wondering why so many triggers are before triggers. There’s a good reason – they’re simpler to use. If you need to make any changes to a record entering your after trigger, you have to do a DML statement. This isn’t necessary in a before trigger – changes to records entering your trigger always save!
The specific use case of an after trigger is when you need to associate any record to a record being created in your trigger. Here’s an example:
// Automatically create an Opp when an Account is createdtrigger AutoOpp on Account(after insert) { List newOpps = new List(); for (Account acc : Trigger.new) { Opportunity opp = new Opportunity(); opp.Name = acc.Name + ' Opportunity'; opp.StageName = 'Prospecting'; opp.CloseDate = Date.today() + 90; opp.AccountId = acc.Id; // Use the trigger record's ID newOpps.add(opp); } insert newOpps;}
Your Comment
You may be wondering why so many triggers are before triggers. There’s a good reason – they’re simpler to use. If you need to make any changes to a record entering your after trigger, you have to do a DML statement. This isn’t necessary in a before trigger – changes to records entering your trigger always save!
The specific use case of an after trigger is when you need to associate any record to a record being created in your trigger. Here’s an example:
// Automatically create an Opp when an Account is createdtrigger AutoOpp on Account(after insert) { List
- 0
- 0
- New Answer
- Contributors: *,
More Management Questions..
What is software configuration management?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Management,
What is the difference between cost accounting, management accounting and financial accounting?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Management,
What is channel management?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Management,
Explain importance of Brand Management
- 0
- 0 |
- |
- Post Answer |
- Answers ( 0 )
- Tags: Management,
What is Ediint ?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Management,
What are the different types of security services involved in infrastructure management?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 0 )
- Tags: Management,
Which oracle package is used to manage the oracle lock management services?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Management,
What do you mean by drill mode?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Management,
what is master data harmonization ?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Management,
what is the formula to get to 'labour efficiency variance'?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Management,
How would your co-workers describe you?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 0 )
- Tags: Management,
Explain "Obtain Message First, Then Process Data" ?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Management,
Name the tasks of universe designer.
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Management,
How have you improved the capabilities of people in a team you have managed?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 0 )
- Tags: Management,
what is discount cash flow management?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Management,
Have you ever conducted staff training or done presentations?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Management,
Tell me about the password management in miis (microsoft identity integration server)?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Management,
What is the role of channel manager?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Management,
What do you mean by committee organization?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Management,
If the end user’s travel location is not in the system. What do we often recommend?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 0 )
- Tags: Management,