Actions in Rules

Actions define what a rule does. Use constants to make it easier to perform any action.

Actions 

Actions define the way rules change an app’s JSON files. Valid actions are:

  • delete: Delete a node in the document.
  • put: Add a node to an object.
  • set: Set the value of an existing node in the document.
  • add: Add an element to an array
  • eval: Evaluate a specified expression and assign results to a variable.
  • replace: Search and replace a text string globally.

Each action has a path attribute, which is a JsonPath that points to a node in the document. JsonPath is to JSON as XPath is to XML. Practice it in the Jayway JsonPath Evaluator.

If a template is updated to change the assetVersion, it can impact the JsonPath. Always test the rules for app creation after a template update.

Note

Actions can be conditionally applied to a document. Set the condition on a set of actions or on a collection of actions.