SuiteCRM 8.3 - Enabling workflow creates a problem with invoice

I’m using a workflow that sends an email to the related contact when an invoice is created and associated with a contact.

After I create the invoice (including line items) and submit, the page is just blank. Nothing is happening on the browser.
If I go to the invoice list and open the invoice I just created, the line items are not there. Only the total / grand total amounts are remain.

If I disable the workflow, there is no problem creating and associating the invoice to the contact. The line items are there as well.

This is the workflow I’m using.

This is the invoice where the line items are not saved when the workflow is enabled.

I hope there is way around this. Thanks.

Screen shot your workflow. Likely the workflow configuration is the problem and is erroring out before save and causing problems with your Invoice.

Thanks. Here is a screenshot.

The mail template “Send Email to Contact” is very simple. It only contains “This is an auto notification email” message.

That’s not going to work. Workflows run as a before save hook. The relationship to the contact is created after the Invoice record is saved. There will never be a related contact to send the email to at the point in time when it runs and it will fail.

Try setting it up to run in the scheduler instead of on save and my guess is it will work.

Thank you.

Sorry, I forgot to mention that email is being sent correctly (to the contact) when I run the workflow on “Only On Save”, with the “Related Field” set to “Contact”. Although there is still the issue where the invoice created does not save the “line items”.

I did try your recommendation to run the workflow on “Only In The Scheduler”. It sent the email and there was no issue with the invoice “line items”. However, it keeps sending the same email every minute. Is there a way to tell the CRM to only send it once?

I looked into the Scheduler and I see the built-in “Workflow Tasks” that runs every minute. I do not see any option to keep track of email actions. Below is a screenshot of this “Workflow Tasks” in the scheduler.

Uncheck repeated runs if you have it checked.

Otherwise it will run on every “status=paid” every minute.

Careful, with a lot of data this sort of workflow can bring you performance problems, as time goes by, and records accumulate in aow_processed table (which controls repeated runs).

If you can add more conditions to limit the amount of records examined in each workflow run, it’s better. And consider using a field inside the record itself to avoid repetitions - at least that way you know where things are and what you can delete later on.

I unchecked repeated runs but it still sends email every minute.
This is the screenshot of my current workflow settings.

I did initially ran workflow “Only On Save”. It sends the email once I modify the invoice, but the “line items” do not get saved. The grand total is there, but line items disappear on the invoice.

I will also try what you said about using the scheduler. Thank you.

Instead of running on all records you might want to consider adding in your conditions “any change in” the status field and only run on modified records. (I’m assuming you send an invoice and get paid later).