+ 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.