36 Trigger Scenarios in Salesforce with Solution – Part 1
=========================================================
1. Write a trigger on Account, when an account is inserted, automatically
account billing address should populate into the account shipping
address.
2. Write a trigger on the Account when the Account is updated check all
opportunities related to the account. Update all Opportunities Stage to close lost
if an opportunity created date is greater than 30 days from today and stage not
equal to close won.
3. Once an Account is inserted an email should go to the System Admin user
with specified text below.
An account has been created and the name is “Account Name”.
4. Once an Account will update then that Account will update with the total
amount from All its Opportunities on the Account Level. The account field name
would be ” Total Opportunity Amount “.
5. Create a field on Account Named (Client Contact lookup to Contact). Once
an Account is inserted a Contact will create with the name of the Account and
that Contact will be the Client Contact on the Account.
6. Create a field on Opportunity Line item(Serial No (Text)) and populate
increment values once an Opportunity Line Item is added. Let’s say if we add 3
products then the sequence would be “1,2,3”. Now if we delete 2 and again add
one more product this must be 4 irrespective of the deleted sequence number.
36 Trigger Scenarios in Salesforce with Solution – Part 2
=========================================================
1. Write a trigger on contact to prevent duplicate records based on Contact Email &
Contact Phone.
2. Write a trigger, only the system admin user should be able to delete the task.
3. Create a duplicate lead when a lead is inserted.
4. Upload any pdf file into Document first. Send an email as an attachment to the
lead email Id when a lead is created.
Email Subject: Welcome
Body: Please find the attached PDF.
5. Write a trigger on Contact, when contact is inserted an email should be sent to
the contact email id with a specified template. So first you need to create a text
template. The template Design is below.
6. When an opportunity line item is created an email should go to Opportunity
Account Client Contact — Client Contact would be a field on Account lookup to
contact.