The CreatorCon Call for Content is officially open! Get started here.

Is workflow supposed to trigger business rules?

tahnalos
Kilo Sage

I have a business rule that is triggered whenever a particular field is changed.   I have observed that for the most part, the rule works except for one instance.

This field is also modified in workflow that is attached to the same form.   Because the process is complicated, all updates are accomplished via script, ie. current.<fieldname>.   What I'm noticing is that the changing of the field in this manner does not appear to trigger the business rule.   Am I supposed to only use the Set As activity in this instance and will it trigger the business rule?   Or am I doing something else wrong?

1 ACCEPTED SOLUTION

You are correct,   in normal use, you would NOT update the current object in your business rule. ( I'm assuming that it is a BEFORE rule and that you're only operating on the current object ).   The system will update the current object after all the BEFORE business rules have run.



So this leaves us with the question of why isn't the business rule running, and how do you know it's not running?


To this end, why not put a log message in your script, near the beginning. Something like:



gs.log("This BR is running");



Then run your workflow and examine the system log.   Is this message there?   Is there anything else related to the business rule in the log?


View solution in original post

4 REPLIES 4

HugoFirst
Kilo Sage

It's possible that the script in the workflow has a statement like this:


ritm.setWorkflow(false);



( the text ritm may vary ).



This will allow the workflow script to update records without invoking other business rules.


I don't see it in the script at all.



The script also doesn't have a current.update() line and I think there isn't supposed to be one when you are setting things on current in a script.   At least that is what I was told.


You are correct,   in normal use, you would NOT update the current object in your business rule. ( I'm assuming that it is a BEFORE rule and that you're only operating on the current object ).   The system will update the current object after all the BEFORE business rules have run.



So this leaves us with the question of why isn't the business rule running, and how do you know it's not running?


To this end, why not put a log message in your script, near the beginning. Something like:



gs.log("This BR is running");



Then run your workflow and examine the system log.   Is this message there?   Is there anything else related to the business rule in the log?


DOH



Business rule was running before, not after.



Thanks.