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
vanessa veronvanessa veron 

Update Custom Object


Hi...
I have a custom object that I would like to change the value of field PREVIOUS_FIRE this my object, when the PreviousFireTime of CronTrigger value be changed.
How do I update the field from my custom object based on field CronTrigger?

Thank you
Sonam_SFDCSonam_SFDC
Is CronTrigger a custom object and PreviousFireTime and PREVIOUS_FIRE are field on the CronTrigger object?

If yes, you can create a trigger on CronTrigger object at insert,update such that when the vaue of  PreviousFireTime is changed, you can fetch the value of PREVIOUS_FIRE and change it.

reference: http://www.jonathanbroquist.com/using-trigger-old-trigger-new-to-detect-when-field-values-change/ 
vanessa veronvanessa veron
CronTrigger is an object of salesforce.
There I built it.

How do I get updates LAST EXECUTION  within CronTrigger of Salesforce to update the field of my custom object?

Thank you
Sonam_SFDCSonam_SFDC
Okay, following is what you can do..
Since you are looking to capture the last execution(or I can say the last creation or updation on the CronTrigger object), you can create a trigger as follows:

trigger UpdateField on CronTrigger(after insert, after update, after delete, after undelete) {
 
//WRITE CODE TO FETCH(USING SOQL) AND INSERT/UPDATE THE FIELD(say X) ROM ANOTHER OBJECT
 

  insert X;
}

sample code thru which you can get some ideas how to code:
http://developer.force.com/cookbook/recipe/mass-updating-contacts-when-an-account-changes
vanessa veronvanessa veron
Is it possible a trigger on CRONTRIGGER?

It's TRUE?
Sonam_SFDCSonam_SFDC
Sorry to have confused Standard Crontrigger Object (http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_crontrigger.htm) with a custom object that I thought you might have created in your ORG(thats the reason I checked)...Don't think its possible in the standardto create a trigger here.. I'm checking to see if we can track the updates as you mentioned in your requirement ..