You can create Operations to be run based on any data that changes within your app. For example if a new event is created by a user, like a "New Order", or if any data within your app is updated, like payment balance, or order status, etc.
In this article, we create an API Operation for one of our default learning apps -DemoApp, which you have in your account. This Operation will update one of the object's data fields using the Filer-Trigger-Operation sequence. You can also reference Triggers article, if needed.
Go to API Operations (GREEN MARK) section on the Top Menu of Mobsted platform
Click Add Operation (RED MARK)
Click Mobstedv8 (RED MARK) to see the list of available API methods.
Choose 1.6 Updating Object data (GREEN MARK)
Name your new operation (ORANGE MARK)
Choose Available Key in API Key drop-down (GREEN MARK)
Fill in all required fields (RED MARK ↓). In this example we have only one required field, another API method can have other fields. As a value in the field you can use static data (number, string, etc.) or Hashtags as a dynamic data source (in the Hashtags article you can learn what the #application:id# reference does).
Click Add Field = Value pair and fill in the fields (RED MARK ↓), click Save
Fill in the new field Address (it is the name of the object's columns in DemoApp) with any info you want to be saved into that column by the Operation.
Click Save Operation (RED MARK ↓)
Close Operations window
The operation is ready to use in the trigger or in the mobile app as Action.
Configure Filter and Trigger
Now, we need to setup filter and trigger to add the Operation we made above, which will be automatically run by our app.
Click Menu (RED MARK) and select Objects (GREEN MARK)
Click Add filter (GREEN MARK ↓)
Click Create New Filter (RED MARK ↓)
Configure your new filter.
Choose ActionName in events section (RED MARK ↓) and equals + Water Delivery Order in value section (RED MARK)
Click Save Changes in Filters tab (RED MARK) and go to the Triggers tab (GREEN MARK)
Click Create new trigger
- Configure your new trigger
- Name your trigger (RED MARK ↓)
- choose Events in trigger scope (GREEN MARK)
- choose Automatic in trigger mode (ORANGE MARK)
- choose Instantly in On new data, appearing (BLUE MARK)
- click Start automatic mode (Red button)
Choose UpdateAddress operation in the drop-down and click Add Operation
Close filter's window
Done, now let us check how it works.
Checking the result
You are in the Objects section.
Open the app for any object (RED MARK).
Make sure that all cells in column Address are EMPTY (GREEN MARK).
To open app in your desktop browser(GREEN MARK) or in your mobile - scan QR (RED MARK)
Go to Water delivery page of the Demoapp and make an order. In few seconds trigger will check the new event with ActionName = Water Delivery Order and execute the chosen API operation (UpdateAddress). This ActionName is assigned to a button in the Demoapp. If you refer to point 11 above - we did set up Filter to look for it.
Go to the Objects in DemoApp and find the updated cell in your objects' column.