IF Statement in Webhook

Hi, I’m having trouble with a webhook and I think its due to the IF statements in the JSON text. I tested this previously and it appeared to work, I have tried this using Bot and Workflow and neither the log or monitor app is throwing an error. The app editor itself is not showing any error.

I can’t see anything wrong with the statements myself but maybe there is a specific way to reference expressions in the JSON text that I’m missing?


The whole JSON is pasted below:

"Action": "Add",
"Properties": {
   "Locale": "en-GB",
   "Location": "48.220599, 16.239976",
   "Timezone": "GMT Standard Time"
"Rows": [
<<START: SELECT([Related Material Take Offs][Line Reference],IN([Line Reference],[Request Material]))>>
"Order No":"0",
"Line Reference":"<<[Line Reference]>>",
"Requested Date":"<<TODAY()>>",
"Location Area":"<<[Block]>>",
"Request Type":"Draw Off",
"Take Off Group":"<<[Take Off Group]>>",
"Product Group":"<<[Product Group]>>",
"Product Sub-Group":"<<[Product Sub-Group]>>",
"Product Code":"<<[Product Code]>>",
"Qty Requested":"<<IF(ISNOTBLANK([Required Qty]), [Required Qty], [Take Off Qty])>>",
"Qty Ordered":"<<IF(ISNOTBLANK([Required Qty]), [Required Qty], [Take Off Qty])>>",
"Requested By":"<<[Requested By]>>",
"Date Required":"<<[Take Off Group].[Date Required]>>",
"Requested Delivery Time":"<<[Take Off Group].[Required Start Time]>>"

Both the workflow and BOT do not work with or without the IF statement, so it doesn’t seem to be the issue. Again, no errors in the monitor app or audit log.

These were both tested thoroughly and were working just last week, I have been on leave since last Thursday so nothing would have been updated to change the content.

I’m not sure if this is due to the workflow migration? Has anyone else been experiencing issues

In what way doesn’t it work?

1 Like

Well it is made up of three steps.

  1. The selected rows are copied from one table to another (Material Take Offs Tbl → Order Details Tbl)

  2. Each item selected and copied, Request Status is updated to ‘Requested’

  3. The List is reset to blank.

Step 1 is the only stage that doesn’t seem to work, the status and reset happen but the copying of the rows isn’t working. The Audit log and monitor app don’t even register that the event is taking place but because the other steps are updating as they should I know it is being triggered.

1 Like

Not at all clear, then, why you though some IF() statements in your JSON were involved. Perhaps explain?

Please post screenshots of all Automation configuration involved in step (1).

Not sure what you mean about the IF statements. I don’t know for definite that is the issue, it was just my initial thought when it stopped working, perhaps I had not referenced it correctly for example. But it worked in my original testing and removing it didn’t make it work either so I have ruled it out at the moment.

This is my automation steps

Material is selected:



Material Added (This is step 1):


“Action”: “Add”,
“Properties”: {
“Locale”: “en-GB”,
“Location”: “48.220599, 16.239976”,
“Timezone”: “GMT Standard Time”
“Rows”: [
<<START: SELECT([Related Material Take Offs][Line Reference],IN([Line Reference],[Enum Test]))>>
“Order No”:“0”,
“Line Reference”:"<<[Line Reference]>>",
“Requested Date”:"<<TODAY()>>",
“Location Area”:"<<[Block]>>",
“Request Type”:“Draw Off”,
“Take Off Group”:"<<[Take Off Group]>>",
“Product Group”:"<<[Product Group]>>",
“Product Sub-Group”:"<<[Product Sub-Group]>>",
“Product Code”:"<<[Product Code]>>",
“Qty Requested”:"<<IF(ISNOTBLANK([Required Qty]), [Required Qty], [Take Off Qty])>>",
“Qty Ordered”:"<<IF(ISNOTBLANK([Required Qty]), [Required Qty], [Take Off Qty])>>",
“Requested By”:"<<[Requested By]>>",
“Date Required”:"<<[Take Off Group].[Date Required]>>",
“Requested Delivery Time”:"<<[Take Off Group].[Required Start Time]>>"

@Sarah_Keown I see that you’re using a _ComputedKey column. I’m not certain that this is your issue but it may be

Pulled from this post Cant use computed keys

1 Like

I can see in this linked post they were receiving a clear error on this. Would it be the same in every case?

The main reason I’m struggling to understand why its broken, is because I am not getting any error feedback, like they do in this example. And also it did at one point function properly. It just seems that over the past week it has stopped completing all steps of the process.

I had to get a lot of ongoing support from Appsheet support staff to get the function working, they didn’t mention this as an issue either so I’m not sure.

I will mention this to the support team as well, as I have re-opened the ticket I previously had, Thank you for the tip

If the _ComputedKey is the issue then it looks like this event would fail to trigger, producing neither an error nor a result

I did not know this type of expression for template would work. This is not like a syntax being explained by AppSheet template expression documentaion for IF syntax.
I tested quicky with BOT, then returned error. Not sure if the same expression did work in old workflow time.

Is there a correct syntax for this type of expression or is it not possible to include?

I did tests that included the expression but even when I removed it from the body it still wouldnt work

@Zhifeng_Lin FYI

1 Like

Hi Sarah,

Here is a doc on how to use “IF” in template (webhook, email, etc) – Template If Expressions | AppSheet Help Center

if that still doesn’t work properly for you, can you email support@appsheet.com with details of your app and allow access to your apps – go to https://www.appsheet.com/account/account#_tab_acctConfig and check the option that enables support access.

We would like to investigate the issue.


1 Like