Help with Templates

Here is what I am trying to do;

  1. Engineers on site make order requests - Requests table - Request Id, Product, Qty etc
  2. When all requests are made, select Completed button which changes Completed Date/Time in the Daily Orders Completed table to now(). I have an Action to do this.
  3. When Action completed a Workflow will send an email with an attachment containing a list of all the Requests for today.

Having problems constructing template. Any help would be most appreciated.

Hi @Martina What problems are you having?

Lynn,

this is what I have tried and the errors I am getting.

Orders Complete Noto

Completed Date/Time: <<[Completed Date/Time]>>

<<IF: [Order Details].[Requested Date]=today()>>

Requested Orders

<<Start: [Order Details]>>

Product: <<[Product]>>
Qty: <<[Qty Required]>>
Date Required: <<[Date Required]>>

<>

<>

“Errors”: “Error: Workflow rule ‘Orders Complete Noto’ action ‘Daily Orders Complete’ Attachment template. Expression ‘[Order Details].[Requested Date]=today()’ is invalid due to: Error in expression ‘[Order Details].[Requested Date]’ : Unable to find column ‘Order Details’. Error: Workflow rule ‘Orders Complete Noto’ action ‘Daily Orders Complete’ Attachment template. ‘If’ expression ‘[Order Details].[Requested Date]=today()’ yields a result of type ‘’ rather than the expected type ‘Yes/No’. Error: Workflow rule ‘Orders Complete Noto’ action ‘Daily Orders Complete’ Attachment template. Expression ‘[Order Details]’ is invalid due to: Unable to find column ‘Order Details’. Error: Workflow rule ‘Orders Complete Noto’ action ‘Daily Orders Complete’ Attachment template. Start expression ‘[Order Details]’ should generate a List of Ref values. Please verify that it generates a List and that the contents of the List are Ref values. Ref values should come from the ‘Key’ column of the referenced table. Error: Workflow rule ‘Orders Complete Noto’ action ‘Daily Orders Complete’ Attachment template ‘If’ expression ‘[Order Details].[Requested Date]=today()’ does not yield a result of type ‘Yes/No’. Error: Workflow rule ‘Orders Complete Noto’ action ‘Daily Orders Complete’ Body template. Expression ‘[Order Details].[Requested Date]=today()’ is invalid due to: Error in expression ‘[Order Details].[Requested Date]’ : Unable to find column ‘Order Details’. Error: Workflow rule ‘Orders Complete Noto’ action ‘Daily Orders Complete’ Body template. ‘If’ expression ‘[Order Details].[Requested Date]=today()’ yields a result of type ‘’ rather than the expected type ‘Yes/No’. Error: Workflow rule ‘Orders Complete Noto’ action ‘Daily Orders Complete’ Body template ‘If’ expression ‘[Order Details].[Requested Date]=today()’ does not yield a result of type ‘Yes/No’.”,

Hi @Martina Have you had a look at this sample app. it creates a daily report from a slice.
https://www.appsheet.com/samples/An-app-to-help-foremen-keep-a-daily-log-for-construction-projects?appGuidString=4220356b-0300-4266-ba75-a6bb2c748662

Thanks Lynn but I need to send the email once the Action is triggered - in a Workflow, not as a scheduled Report.

I don’t think its possible to do what I am trying to do.
Will just have to send an email to inform the buyer that Daily Requests are Complete.
The buyer can then go and View Slice of Daily Requests.

I can set up a workflow to send an email every time a request is made ([Requested Date] changes to today) but that could trigger 100 emails. I want to send 1 email listing all the Requests whenever the engineers are finished making their requests for the day.

Hi Martina,

I would be surprised if what you are trying to do is impossible.

I am having trouble understanding how your tables are related to one another.

It sounds like you want the workflow rule to be triggered when you set field “Completed Date/Time” in table “Daily Orders Completed” to NOW(). Is that correct?

It sounds like you want to list the related records in the “Requests” table when a record in the “Daily Orders Completed” record is updated. Is that correct?

I am not clear how the “Daily Orders Completed” table and the “Requests” table are related.
In other word, I am not clear how the workflow rule can get from the just updated “Daily Orders Completed” record to the related records in the “Requests” table.

Hi Phil, yes that’s my problem-they are not related.

I want to create a pdf to email of all the records in the Requests table with Date Requested=today() once all requests are done for the day- Engineer would trigger this.

I don’t want to use a report as the completed time will be different every day and buyer needs notification as soon as requests are all completed.

Regards

Martina Hawkins

Computer Systems Analyst

Hi Martina,

You can do that with an event triggered workflow.
The change to set file Date Requested=today() would be the triggering event.
The rule would run immediately once the update occurred.
The email would be sent at once.

I thought your problem was in writing a template that lists the needed records.
Hence my questions.

I think Lynn’s response was trying to direct you to a sample template that might help you in authoring a template. She was not saying you need to use a scheduled Report. Template authoring is largely the same whether you are creating a workflow rule or a report.

That sends an email for every row. I want to wait until all rows have been created for the day and send all rows that have a Date Requested= today() in 1 email.

Regards

Martina Hawkins

Computer Systems Analyst

Hi Martina,

Based on your original post, I thought it was possible to know when all rows have been created for the day. You wrote:

“When all requests are made, select Completed button which changes Completed Date/Time in the Daily Orders Completed table to now(). I have an Action to do this.”

I took this to mean:

  1. That the user would click the “Completed” button after all request are completed for the day.
  2. When this button is clicked, it invokes an action that updates the “Completed Date/Time” field in the “Daily Orders Completed” table.
  3. This will result in an update to the “Daily Orders Completed” table that is sent to the server.

If my understanding is correct, then this update only occurs when all rows are present. If so, the update could trigger a workflow rule that sends one email that includes all of the updates.

That is correct but the Daily Orders Completed table only has one column-Date/Time Completed. It has no relation to the Requests table.
The workflow is built off the Daily Orders Completed change event of Date/Time Completed but the issue is how do I select all the records from the Requests table in the template. I tried above and got errors

Try

<<Start: Filter(Order Details, [Requested Date]=Today()>>

Product: <<[Product]>>
Qty: <<[Qty Required]>>
Date Required: <<[Date Required]>>

<< End >>

Thank You Phil so much. That is exactly what I need.

Just one more question Phil. Do you know if emails come through more quickly once an App is deployed? Taking about 15 mins at the minute.

Whether the app is deployed or not has no effect on how quickly the email is created or sent to the email service.

I would start by checking Audit History to see:

  1. When the email was generated. The times are in GMT. If you are measuring based on the email arrival time in your mailbox, other factors may be at work.
  2. The performance information in the Audit History. If a computation is taking a long time, you will see that.

See topic " Why isn’t my workflow rule working?" in this article https://help.appsheet.com/behavior/workflow-sending-email/troubleshooting-workflow-emails