Workflow Help (On Any Change)

Please help with this. There is another open conversation started by someone else, but it has grown stale. I absolutely have to get this working. I need an email sent when a field changes. It seems the workflow doesn’t fire at all, rather than firing and failing. Other workflows work just fine for me… but none of them look for a particular field change.

As a follow on question, can the email alert template from workflow be configured to use the before_value and after_value for a field from the audit information? Or possibly just insert the “view changes” screen into the email somehow?

Thanks,
sieberta

have you tried to set it to run on all records, not just modified records to see if it kicks off?

McGuire,

That was a good idea and a bad idea. It was a good idea as it led me to part of the problem. It was a bad idea because it caused my system to attempt to generate roughly 5000 emails. Those emails didn’t go through, because my server ip has been blacklisted. It was blacklisted, because to fix this before, I attempted telling it to do “repeated runs”, which also sent 5000 emails. The SMTP server sees 5000 emails in a matter of minutes, and it doesn’t like that much! I need SuiteCRM to give us a testing method for making sure that doens’t happen, or a way to kill the workflow if it is happening (which doesn’t seem to be possible).

Unfortunately, while you led me to 1/2 of the problem, that still doesn’t fix my issue… because as I said, that generated 5000 emails, which is not the solution I’m looking for.

Thanks for trying… any other ideas out there?
sieberta

Hi Sieberta,

You may need to tick the “Repeated Runs” checkbox. When unchecked the Workflow can only run on a Record once.
When checked it allows the Workflow to run on that Record each time the Workflow is fired.

In your case, if a record’s status field was modified, the Workflow would fire the first time it was modified.
If the Status field was modified again, the workflow would not fire unless “Repeated Runs” was checked.

Regards, John

Thanks for responding John. I attempted your suggestion, but there was no change. If I tell it to send an email when a project shows a certain status, that works, but if I say “any change”, it doesn’t.

Hi,

What version of SuiteCRM are you using? I am currently testing this on 7.3.1 and the “Any Change” option works fine for me.

Regards, John

7.1.2… and I’m scared to upgrade in fear of losing customization… but maybe I just need to bite the bullet. I was waiting for dynamic theme & project ghant charts… I have no idea if those are released yet or not. I will check, and if they are, start the upgrade process soon.

Hi sieberta,

Gantt Charts and the Responsive theme were released in version 7.2.0, currently we are on version 7.3.1. If you are worried about losing customizations, you could make a backup of your CRM through the Admin > backups option.

1 Like

I’m now on 7.3.1, and it still doesn’t work. this was a major reason for my upgrade…

Hi Sieberta,

Tried it using the same Conditions as your screenshot. (including: Run Only on save and Run on Modified Records)

How is the Status Field being changed? Does a user manually edit the record & save? Or is it through other means, such as another Workflow that changes it?

Also, what are you sending an E-mail to? Is it A user or a specified E-mail Address?

John,

It is very kind of you to stick with me on this. I’m opening a record, changing the status, and saving the record. The email goes to me, as a user, not as an email address. Which works successfully on half a dozen other workflows.

There is nothing in the logs.

sieberta

More Testing…

It is the condition that is tripping me up (I realize it could be some combination), but if I remove the condition, I can get notified on every project change. Once I add the condition, it never fires on my changes (i.e. the project doesn’t show up in the list). I tried on 2-3 other fields as well, same result (not just status). I also tried a totally different module (Contacts, first with no condition then with Description = any change)… and it behaved the same way.

Also, it is just “on any change”, if I change it to “equals value 234” and then set the value to 234, the workflow runs properly.

Does the Workflow module build SQL on save? If so, is there somewhere I can view the SQL that corresponds to my workflow?

I don’t eve know where it gets its information on any change… from the audit table???
sieberta

Does anyone have any suggestions as to how to troubleshoot this? Is there a way to view the SELECT WHERE SQL statement for the workflow conditions or something along those lines?

sieberta

So I loaded a brand new 7.3.1 install, and yep, it works like a charm. Now on to figuring out how my install is different…

I checked…
Many of the AOW folders/files and sizes of files are the same
The AOW_Conditions table… looks great
Added my custom dropdown options for projects.status… but that didn’t break the fresh install
Added my custom logic_hooks.php… but that didn’t break it either.

Something is different about my 7.3.1 and the fresh/default install, and I’m guessing it is because some file or table didn’t get updated like it should’ve in one of the two upgrades I’ve done over the life of my install.

I don’t really know where to look!
sieberta

GUESS WHAT! I figured out what kills it! If I turn on “auditing” on “status” in “projects” then the workflow stops firing in my brand new 7.3.1 build!

So, now we know the problem… but how in the world do we fix it? I need auditing and workflow that works both on Status!

Am I seriously the only person who has run into this?

EDIT: I just confirmed the same behavior on Contacts:Last Name

sieberta

Hi Sieberta,
Thanks for finding the root of the issue, I’ve logged it as an issue on our Github repository: #548

There aren’t many workarounds for this that I can think of at the moment,

You could disable Auditing on the field, or you could use the following Workflow condition:
Projects > Status > Equal to > One of > {select all values in dropdown}

If you use this Workflow Condition, your Workflow should only send an E-mail when the Project is saved. Due to it being set to run “Only on Save”
Unfortunately, this will cause the Workflow to fire every time you Edit > Save the Project, but this may be more Ideal than nothing at all.
This also allows you to Audit the “Status” field.

Thanks John… I did think up a workaround which I will document below for others who have this issue…

Here is a workaround, but it would be nice to fix this right.

Here is what I did:

  1. Created a new field called status_aow_trigger_c
  2. I ran the following code in phpMyAdmin (I think there is a redundancy in this script, but I felt safer with it in there as I was working in production). The purpose of this is to ensure that all existing projects don’t trigger a WF the first time they are saved after the WF is created… because their existing status won’t equal NULL which would be the value in status_aow_trigger_c
UPDATE project_cstm JOIN project ON project.id = project_cstm.id_c SET project_cstm.status_aow_trigger_c = project.status WHERE project.id = project_cstm.id_c
  1. At this point, my plan was to write a logic hook that would update status_aow_trigger_c on save, and then fire the workflow on any change of status_aow_trigger_c, but then I had a better idea…
  2. I created a workflow triggered on status != status_aow_trigger_c… where I emailed myself and modified the record to set status_aow_trigger_c = status. (see screen shot)

The downsides to this workaround:

  1. Wasted database space on unnecessary/redundant data
  2. The WF will fire on the first save, not just modified records. This could be avoided by creating a duplicate WF that updates the field on new records, but doesn’t email, and only trigger this WF on modified record.
  3. If you have a lot of fields you care about instead of just one (which I would like to have)… this must be duplicated for each field that you have auditing turned on and also want AOW.

Note: if you’re reading this an you’re uncomfortable with phpMyAdmin, I think you could probably use Workflow without a notify action and without repeated runs (that runs on all records) to initially set your values. I’m not sure how long this would take. phpMyAdmin is certainly the preferable route.

sieberta

As a nice side-effect of this work around, if you schedule the email to send BEFORE the record update, you can include the status_aow_trigger_c field in the email and know what the status was BEFORE the change.

sieberta

I’m having the same issue with on any change not working on the Case assigned to field but the assigned to field is not listed in the case field list in studio. So how do I turn off auditing for the assigned to field in cases?