Workflow sending email before data is updated

Hi everyone,

I’m having problems with calculated values and workflows.

I have a workflow that sends an email notification when a job is finished, and I’m using a template as body. This is working correctly, but my problems come with calculated values. When a user completes the form, some columns are calculated with a formula and the email I’m receiving from the workflow is not waiting these values to be updated. Is there any way to say AppSheet "do not send the email until everything is completly updated?

Thank you in advance!

0 27 1,577
27 REPLIES 27

@Ruben_Lopez
If the number or those computed columns are not too much, you can construct an AND expression for your workflow’s conditional rule:

AND(
[_THISROW_BEFORE].[ColumnA]<> [_THISROW_AFTER].[ColumnA],
[_THISROW_BEFORE].[ColumnB]<> [_THISROW_AFTER].[ColumnB],
[_THISROW_BEFORE].[ColumnC]<> [_THISROW_AFTER].[ColumnC]
)

Thank you for your reply @LeventK.

I’m wondering if, doing that, I will not receive any email if the values are not updated at the time the workflow is running, am I right?

@Ruben_Lopez correct. The workflow will run when the condition is met.

I understand, @LeventK, but the problem is that I need to send the email always. Everytime a job is finished, the workflow should take values from that job and send them by email. Using your workaround, as it seems there is a problem waiting for updates, there will be a lot of cases where the emails will not be send.

@Ruben_Lopez
You said that your worflow email is sending the email without some columns data are updated because of expressions. I believe you should have some expression as a conditional rule in your workflow rule which I’m not aware, but provided you concatenate your existing conditional expression with the sample I have given, it will solve the problem.

Hi

I have same issue. After adding a new row email is sent but some column values are updated after some time and email doesn't wait for it. 

 

Will this solution help for me? 

Waiting for the positive response

Thanks

Hi Ruben,

Before we invoke the workflow rule, we do the following:

  1. We apply the changes made by the client.
  2. We re-read the record after the client change has been applied. We do this when you are updating a Google or Excel worksheet. This allows us to obtain the updated worksheet formula values.
  3. We recompute AppSheet virtual column values to ensure they reflect the latest data values.
  4. We invoke the workflow rule.

Can you explain the problem you are seeing in more detail? What are you doing and what specifically appears to be incorrect?

Hi @Phil, thank you for your reply. My problem is that when I received the email from the workflow, the value from calculated column was incorrect, it was the previous value before saving changes. I’m going to repeat the process to see if it’s happening everytime or it’s just happening randomly. I’ll be back when I try it.

Hi again @Phil, I’ve been trying the process again and it’s still happening. Here you have some screenshots:

  • Values in spreadsheet before saving

  • Values in spreadsheet after saving

  • After saving, workflow runs. Received email:

1X_bfacd7fc6a93c19c90b195f5ec2af6158d99920c.png

As you can see, the last value in the email is showing “Merienda,” but the value from the spreadsheet should be “Comida, Merienda,”. The formula is computing some complements depending on some hours. What could be wrong?

Thank you in advance!

@Ruben_Lopez
How do you trigger this workflow? What is the expression you have set in your conditional rule?

This is the expression: AND(ISNOTBLANK([Agente - Hora de salida]),[Estado actual]<>“NOTIFICADO”)

Basically, when a value from the table has been filled and if the job hasn’t been notified yet.

@Ruben_Lopez
if your [Complementos generados] column is also expected to change with each trigger, may be you should consider adding this expression to your conditional rule also:

COUNT(SPLIT([_THISROW_BEFORE].[Complementos generados]," , "))<>COUNT(SPLIT([_THISROW_AFTER].[Complementos generados]," , "))

I understand what you mean, @LeventK. I will try it, but I’m afraid adding this condition, it will stop my notification and it won’t send me an email with values updated. I will be back as soon as I try it. Thank you.

Hi Ruben,

Can you provide:

  1. Your account id
  2. Your application name
  3. The workflow rule name
  4. The exact steps to reproduce the problem.

I will need to repeat the steps while running the debugger to watch what happens. This may mean either adding or updating records depending on the repro steps you provide.

Hi @Phil, sorry for late reply. I think I’ve found what’s wrong, but it’s still strange.

My scenario is a bit complex, I’m using slices to create 3 different forms, each of them has different columns and 3 different users need to fill them. The column with the formula computing complements doesn’t appear in any of the forms, but it’s being computed anyways.

Then, I tried to create a form with all the columns (without slices) and, in this case, it worked and I received the value updated on the email.

After that, I included the column with the formula in the slices and it worked too.

So, the problem appears when using slices and not including the column with the formula. It has sense for me, but I don’t understand why the value is computed after the notification. Is this an expected behaviour? It would have sense if the value is not updated when the column doesn’t appear on the slices. What do you think?

Anyways, let me know if you need my account id, application name, etc to check it.

Hi Ruben,

I am not surprised that we only compute the virtual column when it is included in the slice. Computing virtual column values is expensive, so we try to only compute virtual columns when necessary.

To give you a definitive answer, I would need to investigate using your application. I am happy to do that, but it would take an hour or two of effort on my part. I would need the account id, etc to do that.

Hi @Phil, I am out the office until tuesday. As soon as I come back I will send you all the information you need and the steps to replicate the “issue”.

Thanks for your help.

I have the same problem. PDF template arrives empty because the workflow executes before the data impacts google sheet. If I update only 1 field and save, the PDF arrives correctly with the data.

Are you using related table structure (Parent & Child) with your workflow?

Yes I am. Child table data is not arriving.

If you are running the workflow from the parent table, than that’s the reason because AppSheet records the parent data first and then the child table. If your workflow template is containing child data, then they will appear as blank because they haven’t been recorded yet.
Check this portfolio app by Master @Aleksi
https://www.appsheet.com/samples/How-to-send-Workflow-email-with-child-records-when-parent-record-is...

Ok Levent, so what’s the solution?

Thanks for the answer,

He provided one. Perhaps read his response again.

I have seen the portfolio app and it is also runned from the parent table, maybe i’m missing something.

Thanks Steve.

You are probably missing how the workflow is triggered. It’s triggered with an update, not with adds. And the other one is that there is an action that it’s triggered when the parent record is saved. That action is triggered from the Event action (Parent_Form).

Thanks Aleksi! update trigger works well.

You’re welcome

Top Labels in this Space