Help! Workflow Field Any Change Condition Doesn't Work? Bug?

I have a workflow setup for Cases module set to run on MODIFIED records, repeated runs, and the condition is if the Assigned To field value has any change.

If I edit a case and change the assigned to value, it doesn’t run.

Other workflows work fine. I tried another test workflow to trigger if the Assigned to is equal to a specific user and it runs fine. SuiteCRM AOW is not seeing the Assigned To as being changed for the Any Change condition for some reason.

I am running 7.2.1. I have of course to a Quick Repair.

I’m not expecting a quick solution as I’ve scoured buth Sugar and Suite message boards and have turned up nothing.

However, IT WOULD BE EXTREMELY HELPFUL if another SuiteCRM user could setup a test workflow with the same condition (Case, Assigned To, equal to, any change) and see if it works.

At least then I can confirm if this is a bug in all installations or the problem is unique to me.

Thank you in advanced to whomever can do this for me. Should only take a minute or two.

I found where in the AOW_Workflow.php file it checks the condition and added a debug line. It’s thinking the previous value for the field is the new value:

Line 558 I added: echo $condition->value_type." field=$field value=$value cond=".$condition->operator."
";

Output is:

Any_Change field=9d7a2c2b-437b-a6d7-e156-556075df34c4 value=9d7a2c2b-437b-a6d7-e156-556075df34c4 cond=Not_Equal

If I change the Assigned to the administrator the values come back 1 and 1 since admin account is ID 1.

So I need to figure out if

(a) Where it is pulling what it thinks is the previous field value from (is that $field or $value? in the function?)

(b) If the workflow is somehow being run AFTER the Case record is saved instead of before?

Well I think the workflow is being run after the new case record is saved because I put a PHP exit after that echo statement so the code stops there and if it was being executed prior to the case save, the case wouldn’t get update but it does.

But the audit record write function exectues after the workflow and the change long shows that field change so the audit record function IS getting the previous value from SOMEWHERE?

So this means the “Any Change” condition must be trying to get the previous field value from somewhere else but where?

Line 437 $condition_bean = $bean; is where the values come in
Then field is later set by $field = $condition_bean->$field;

The change log for the cases shows the field change appropriately.

Still wondering if this is a bug others are seeing.

For now, I figured out a workaround of adding a custom field ‘old_assigned_user_id’ and I just have to set two conditions:

  • Assigned To is not equal to NULL
  • Old Assigned To is not equal to the Assigned to

Then add an action to update the Old Assigned To field to the new value. (I want the workflow to run only on the first time the case is assigned to someone. Additional workflows will handle if pre-existing assigned to is changed.)

I agree… The “equal to any change” condition doesn’t seem to work correctly. I am having further problems, whereby if I just want to know that a record was modified, and don’t put in any condition, if I don’t allow multiple runs, I only hear about it the first time. If I do allow multiple runs, I get A TON of emails from projects that haven’t changed.

This is going to be a problem for me on multiple fronts.

sieberta

Also, if one starts a workflow that thinks it needs to run on every record in the database (possibly multiple times) how does one kill such a workflow?

Thanks,
sieberta

Hey there, I am having the exact same problem; did you find a fix for this?

@SuiteCRM: why havent you responded??

Will, this appears to have been discussed on multiple occasions. Please confirm if this has been fixed.

websolprov,

Are you trying to fire a workflow for just one field having been changed? If so, the problem is related to auditing. You can shut off auditing on that field and workflow fires properly. Or if you must have auditing on the field, you can make a dummy field (that you don’t show) that represents the “previous” value of the field. Then fire the workflow on the real field and the dummy field not matching each other, then make one of the actions to make them equal each other. This is what I ended up having to do. This gives you the added benefit, if you are sending an email on the workflow, of reporting what the old value was. You can have auditing on on both fields (since you are no longer using “on any change” but rather the two fields not being equal), but there is no reason to have it on on the dummy field.

It is a bug, but there is a workaround (or two).

sieberta

With Version 7.6.7 Sugar Version 6.5.24 (Build 509) the “any chage condition” works OK and it’s not required the workaround.

:oops: Sorry… I was on error… with suiteCRM 7.6.7 Sugar Version 6.5.24 (Build 509) it’s not working and the workaround suggested is required.