Executing Dynamics 365 Rules with the Rules Engine Action
The InRule Solution contains a plugin that has a preregistered step called the RulesEngineAction. The InRule Custom Action allows developers to trigger the execution of rules by calling into the Dataverse API. Actions provide an easy way to trigger functionality in Dynamics and can be invoked using multiple different methods. Registering an action creates a corresponding web API endpoint. This endpoint can be used by external code, or in the case of the Run Rules button, called from JavaScript. Actions can also be called from workflows directly with the workflow designer, or through a custom workflow activity.
To call this endpoint, you will need to make a POST request to the following url: https://[your_org_url]/api/data/v9.0/inrule_RulesEngineAction. The body of the request should contain a JSON object string with the following fields. 'ruleSetName' can be either a rule set or decision name. Label and ruleParameters are optional. If 'label' is not supplied, the default value configured on the execution service will be used. To pass parameters to the rule set or decision, use ruleParameters and provide a JSON string in the following format: {"parameter1Name":"parameter1Value", "parameter2Name":"parameter2Value"}
- entityId
- entityTypeName
- ruleAppName
- ruleSetName
- persistChanges
- label
- ruleParameters
The custom action will return a JSON response with the following schema. This schema can be supplied to JSON parsing steps in Power Automate flows to help with processing rule execution results
{ "type": "object", "properties":{
"NotificationResponse": { "type": "object", "properties": {
"Notifications": { "type": "array", "items": { "type": "object", "properties": {
"Type": { "type": "integer" },
"Message": { "type": "string" } },
"required": [ "Type", "Message" ] } } } },
"ValidationResponse": { "type": "object", "properties": {
"Validations": { "type": "array", "items": { "type": "object", "properties": {
"FieldName": { "type": "string" },
"FieldDisplayName": { "type": "string" },
"Message": { "type": "string" } },
"required": [ "FieldName", "FieldDisplayName", "Message" ] } } } },
"ContextResponse": { "type": "object", "properties": {
"PropertyBag": { "type": "array", "items": { "type": "object", "properties": {
"key": { "type": "string" },
"value": { "type": "string" } },
"required": [ "key", "value" ] } } } },
"ErrorResponse": { "type": "object", "properties": {
"Errors": { "type": "array", "items": { "type": "object", "properties": {
"Source": { "type": "string" },
"Message": { "type": "string" } },
"required": [ "Source", "Message" ] } } } } }
}