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
Tommy GeorgiouTommy Georgiou 

trigger to update a field when a custom object receives information

HI All,

I have a custom object named Reservations where I have nearly to 65 custom fields. This object is related to Contacts.On contacts I have a custom field (checkbox) saying if the contact responded 60 days from the time I have send him a newsletter. 

So my problem is that if the client comes back to me with a new reservation before the 60 days expires that custom field on contact should be checked.
If not will remain unchecked.
Any suggestions?
SonamSonam (Salesforce Developers) 
You can try the following approach:
1)Create a custom field on the contact that stores the last date when a newsletter was sent(this would be a trigger on task object as I assume the newsletter will be a Email task)
2)Create a trigger on reservations object such that it can pull the contact associated and then the value of the contact custom field can be compared with the current date on new reservation creation and if its within 60 days - you can check the contact box.

Tommy GeorgiouTommy Georgiou
Hi Sonam,

Thank you very much. 
Could you please help me a bit with the trigger as I am new to this and don't have a lot of experience?