Force automation in the background

I have a long and convoluted process that can take 5mins to complete. At the moment this is a workflow which runs when a new row is saved. This workflow then calls a whole host of grouped and nested actions, about 20 in all.

I want to convert it so that the users doesn’t have to see wait for all sync changes to happen. Is there a way of doing this without having it run on a schedule?

1 16 519
16 REPLIES 16

Convoluted possible solution: have a bot that sends a webhook action to appsheet to add the new row and trigger the large workflow and run the webhook asynchronously. This SHOULD make it run “in the background”.
Enabling delayed sync and automatic updates is another possible solution.

Do I need to enable " IN: from cloud services to your app" for this to work?

I have never used the API functionality of appsheet so I am not sure but I think you do use that app ID

Ok so I can see that I need to use

https://api.appsheet.com/api/v2/apps/{appId}/tables/{tableName}/Action

to call the API. I understand {appID} & {table} . But how do I specificy the action I want it run? Should it be …/{ActionName} instead of /Action? Or do I have to do something with the HTTP headers?

So to try and simplify this I want to run an existing action called “Order Materials for this PO” which is in the “PO” table. I want it to run to run asynchronously"

Action already exists and works fine

Can anyone help with this?

I don’t believe there’s any support for asynchronous execution.

Says it is at the bottom of here, unless I’m misreading it

I have some processes that work the way you describe. I have an action that writes a value “WEBHOOK” to column [Submitted]. My event in automation triggers when “WEBHOOK” is detected in the column. It then fires the asynchronous Webhook which would otherwise involve a long sync time on the client. Images below.



Awesome @APiCC_Conor ill try to copy that and come back to you

For additional reference, this is the rest of the webhook task,


and here is the body of the webhook

{
   "Action": "Edit",
   "Properties": {
      "Locale": "en-US",
      "Timezone": "Central Standard Time",
      "RunAsUserEmail": "<<useremail()>>",
      "Usersettings": {
        "Jobsite": "<<usersettings(Jobsite)>>",
        "Payroll Period": "<<usersettings(Payroll Period)>>"
      }
   },
   "Rows": [
      {
         "Jobsite": "<<usersettings(Jobsite)>>",
         "Submitted": "<<text(TRUE)>>",
         "UniqueID": "<<usersettings(Payroll Period)>>"
      }
   ]
}

Are you saying that your users have to wait the entire 5 minutes for the workflow to run? I’ve never experienced that. I thought workflows already ran on the server?

When invoking an Action via webhook, you specify the action name, and the rows for it to run on in the Body. See this article:

So the workflow runs on save. The action typically has to create 100-200 new rows in a different table and you can see that each one takes 5-10secs to complete. Also upon clicking save it hangs for about 20-30secs. The user can obviously still use the App but they often need to do this process 40-50 times in succession so the hanging and syncing is a significant time. Also anything else they try to do in the app gets delayed in this massive que of syncs

Using a Form Saved event action? That’s not a workflow.

Maybe I should have said created…

I had this exact same problem, especially with the freeze/hang after hitting the save button. I turned it into a webhook that adds rows with a start expression based on a ref/list column.


{
   "Action": "Add",
   "Properties": {
      "Locale": "en-US",
      "Timezone": "Central Standard Time",
      "RunAsUserEmail": "<<useremail()>>",
      "Usersettings": {
          "Payroll Period": "<<usersettings(Payroll Period)>>",
          "Jobsite": "<<usersettings(jobsite)>>"
      }
   },
   "Rows": [
       <<Start: [Employee Names]>>
      {
         "Creator": "<<useremail()>>",
         "Date": "<<[_thisrow-1].[Date]>>",
         "Employee Name": "<<[UniqueID]>>",
         "Class": "<<[Class]>>",
         "Absent": "<<[_thisrow-1].[Absent]>>",
         "Arrived Late": "<<FALSE>>",
         "Left Early": "<<FALSE>>",
         "RefTimeCard": "<<[_thisrow-1].[RefTimeCard]>>",
         "RefActivity": "<<[_thisrow-1].[uniqueid]>>"
      }
      <<End>>
   ]
}
Top Labels in this Space