Using automated actions, we can automatically initiate some actions based on certain conditions. Let's use an example of altering the cost of the product when the status of the product changes from in use to deprecated. Click the Automation button at the top of the product form view while it opens in studio edit mode, as shown in the image below.
Before the record may be updated, the domain requirements must be met. In order to do this, we have to click the Edit Domain button and apply filters as described below.
Since we will be updating the field cost in the product, choose cost under the data to write section. Give the evaluation type as a value and set the value to 0.
Here, we can see the fields Action name, which is the name of the automated action, model, and active Boolean button, which is used to activate the action. The rule will not be executed if this Boolean value is disabled, which will hide it. The next field is the trigger, which is a selection field. Here, we have to choose the appropriate trigger time for the action. We have selected ‘on update.’ The following two fields are used to specify the domains for this automated action. The first one is the ‘Before update’ domain. This condition must be met before the record may be updated if this domain is specified. Next is ‘Apply on’ domain. If we set this domain, then this condition needs to be met before the action rule is executed. Here, we can see how many records there are in our case with that particular status. We have given action to do as updating the record. The field cost is selected under the Data to write tab. The evaluation type is set to "value," and the value field is set to 0 since we need to change the price to zero while changing the status of the product from in use to deprecated.
Let's see how it works. Open the product form view. We can see that the product's status is 'IN USE' and that its price is 287 in the image below.
The cost will be automatically updated to zero once we change its status from ‘IN USE’ to ’DEPRICATED’, as seen in the figure below.
This is how we initiate some actions based on certain conditions using automated actions.