You need to sign in to do that
Don't have an account?
Time Dependent Trigger Issue
I have a scenario wherein :
1. If any field gets updated in Opportunity (master) a workflow (outbound message) has to be fired from custom_object__c (detail). This custom_object__c has some formula fields which takes value from Opportunity and some other fields. So with the help of this workflow I send(to another system) all fields of custom_object__c via outbound message.
For this I have created:
A. a custom_field__c (of dataType checkbox) in custom_object__c,
B. a trigger (it has a functionality that if any field gets updated in Opportunity the value of custom_field__c becomes true ).
trigger tgrAfterUpdateOpportunity on Opportunity (After update) {
}
C. And on the basis of status of custom_field__c (if true) a workflow is fired and hence the outbound message.
2. Now the problem arises is that once the value of custom_field__c becomes true my workflow becomes useless as it is not sending the new updated values of opportunity (it sending the same values as when the custom_object__c becomes true for the first time)
For this I have created a time dependent workflow which toggles the value of custom_field__c after defined time, and hence my functionality again starts working fine.
But the main issue is Time-Dependent Workflow Actions has minimum time limit of 1 hour . So is there any method by which I can set a Time-Dependent Workflow's limit to few seconds or a sew minute at max? (so that my functionality keeps on working fine continuously.) or else please suggest some idea wherein the value of custom_field__c gets toggled after the outbound message (of first workflow ) has been fired.
Any help would be highly appriciated.
Thanks
R_Shri
Alternatively, you could also just use a @future method to uncheck the box. The time it takes for the asynchronous code takes to execute is usually within a few seconds, but guaranteed to occur after the transaction completes. It would also be similarly possible to use the new System.scheduleBatch function to kick off a batch class that executes after the transaction completes about a minute later, or you can also just System.executeBatch, which also won't execute until the current transaction completes.
You could also have the outbound message handler (the server that processes the outbound messaging) to update the checkbox for you using the API.
All Answers
Alternatively, you could also just use a @future method to uncheck the box. The time it takes for the asynchronous code takes to execute is usually within a few seconds, but guaranteed to occur after the transaction completes. It would also be similarly possible to use the new System.scheduleBatch function to kick off a batch class that executes after the transaction completes about a minute later, or you can also just System.executeBatch, which also won't execute until the current transaction completes.
You could also have the outbound message handler (the server that processes the outbound messaging) to update the checkbox for you using the API.
Hi sfdcfox,
Thanks for the solution. It worked perfectly.
I have one question, can we perform same task (sending outbound message from detail object) without writing a trigger? (Since trigger will add to maintenance cost in the long run.)