function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Irish@accIrish@acc 

trigger to create record when the date field changes the 2nd time onwards

Hi,

can anybody tell me what logic should be used to create a child record when the date field changes for the 2nd time onwards...?

 

I have a date field in the parent object when this date field changes don't create the recod when it changes the 2nd time then creates the record...how to do it?

Best Answer chosen by Admin (Salesforce Developers) 
MJ Kahn / OpFocusMJ Kahn / OpFocus

Add a number field to the parent object and use a trigger to increment it whenever the date field changes. When the value becomes 2 you can create your child record.

All Answers

MJ Kahn / OpFocusMJ Kahn / OpFocus

Add a number field to the parent object and use a trigger to increment it whenever the date field changes. When the value becomes 2 you can create your child record.

This was selected as the best answer
Vinit_KumarVinit_Kumar
Agreed with MJ Kahn / OpFo , you can store the value of field updating on Date field on a number field and if that value is equal to 2,you can create a child record.