You need to sign in to do that
Don't have an account?
nsoos
Apex code to trigger workflow rule
Hi,
Is there a way to create an APEX code that triggers a workflow based on a formula field value?
I would like a workflow to be triggered if a formula field "error_c" is "Yes"
Is this possible?
Many Thanks
for this you dont need a trigger you can simply check for the formula field value in the workflow condition and make the work flow to fire based on the value.
Hi Anil,
Thank you for the reply.
The condition can be applied but workflows only trigger when the record itself is edited/or created. When the formula value is updated, the record is not edited by a user.
I would need an apex code for this I believe.
Do you have any other way to get around it?
Thanks a lot
Nora
Hi Nora,
Please create a workflow rule with Rule Criteria as formula. This will help to fire the workflow when the formula field will be updated by the system.
I hope this helps.
Thanks,
Prolay
Even trigger wont work on this scenario because record wont be modified.
Can u tell me what the workflow will do after the formula is filled with certain value.
Hi Anil,
Thanks for looking into this for me in more detail.
I have 3 custom objects
Object A "Order" Order_c has a field "Outstanding_Product_c" which is a simple formula of (=No of Product Ordered-No of Product Delievered). The value of this field changes constantly as Product is delivered
Object B "Association Page" Association_page_c is an association page for many-to-many relationship is a child record of "Order" and Object C "Supply".
I would like the "Outstanding_Product_c" field (real time data) to appear on this page. I have done so already with a simple cross-object formula. But I would like to use the value (real time value again) in a roll-up summary field in "Supply" and the cross-object formula cannot be used for that. This is why I thought that I will use a workflow that updates a simple text field but the workflow is not triggered everytime the value of the formula changes.
Ultimately i would like ot take the real time value of Object A "Order" and bring it to Object C "Supply" via the association page Object C "Association Page".
I appreciate your help.
Nora
What is the relation ship between B and C object if its a Lookup make it Master detail then u can get the data of B object on to c with rollup summary.
The relationship between Object B and C is master, so the roll up is possible, but a formula field can't be rolled-up. It needs to be a text field, that is what I wanted to create and populate with a workflow.
Create a trigger in the object where you enter delivery to update all the fields you need in different objects. You don't need to create a workflow for this.
Hi Val, How do I create a trigger? Do you mean an APEX trigger? Do you have a code for that?
Thanks
http://teachmesalesforce.wordpress.com/category/code-sample/
This link may be useful.
http://www.embracingthecloud.com/2013/01/01/SalesforceCallingApexFromWorkflows.aspx