Macro Use Case: Recursive Operations
Here’s an example of a macro that deletes an sfdcDigest node. It also deletes the digest node and all other nodes that depend on that node.
This macro deletes the specified node and dynamically queries the JSON document to delete each dependency of those nodes.
Consider the simplified JSON below. To delete ‘node3’ and its dependencies, the result should delete: node3, node4, node5 (depends on node4), node6 (depends on node5), node7, node8, node9.
Example JSON
Without Macro
Without using a macro (and associated enhancements), nodes would have to be deleted individually.
This code is rigid and difficult to maintain because rules would need to be modified as node dependencies are added and removed from the JSON payload.
Macro Source
Rule Calling the Macro