-
How to Write Salesforce Triggers for this Scenario?
How to write a triggers for this scenario?
1.Create a date field on Contact - MyDate
Create a date field on Account - MyDateWrite a trigger, Whenever a contact record is inserted under an account then the
new record's MyDate field should be 1 month ahead that of its parent Account's MyDate field. And if multiple
contact records
are inserted under one account then the contact records's MyDate field should be 1 month ahead of each other.
For example:
There are 3 records of accounts - A1 (1st July 2017), A2 (1st Jan 2018), A3 (1st Oct 2017)
Now we are inserting multiple contacts under these 3 accounts like this:
A1 --> C1, C2, C3
A2 --> C4, C5, C6, C7
A3 --> C8, C9So the MyDate fields of new contact records should be like this:
C1 - 1st Aug 2017
C2 - 1st Sep 2017
Log In to reply.
Popular Salesforce Blogs
Choosing Between Salesforce Consulting Firms and Freelancers: What Gets You the Best ROI?
Managing a modern business means juggling multiple tools, systems, and strategies—and Salesforce often sits at the center of it all, from CRM to customer support…
How to Get Current Record Id in Lightning Web Component | Salesforce Developer Guide
Getting record in Lightning Aura Component is quite easy, we use force:hasRecordId and get the result in controller by using, getRecordId:function(component,event, helper){ var currentRecordId…
FlexDeploy Loves Salesforce: Build and Deploy Salesforce DX Apps
FlexDeploy is an Enterprise DevOps platform with fully integrated support for Salesforce apps, metadata customizations, integrations and more. This is the fourth article in a blog…