You are here:
InsQuoteService:invokeRules
Use this service to Invoke state transition rules associated with a target state transition on a target quote.
If the rules satisfy the transition criteria, this service executes actions associated with the transition, optionally logs the results of the rule executions, and transitions the target quote to the new state.
Before this service runs, the system runs a guest user check.
This service can be used by guest users. A guest user who's running an OmniScript,
Integration Procedure, or UI task will be able to continue; this service will run.
However, the quoteId and opportunityId are encrypted in these
cases, so guest users cannot see these Ids.
How It Works
-
This service retrieves the object specified by the quoteId option.
-
Based on the object type, the object's current state, and the toState option, the target state transition is determined.
-
From the state transition, state transition rules, and state transition rule actions, product rules are retrieved and executed.
-
If the state transition rules satisfy the transition completion criteria specified on the state transition, the object is transitioned to the toState.
If the state transition has an action associated with it, that action is executed.
If the transition completion criteria is not satisfied, the object is transitioned to the Alternate state specified on the state transition if it exists. If the state transition has no Alternate state, the object retains its current state.
-
If the logResults option is specified, the results from each rule and the result of the object transaction (success or failure) is logged.
Remote Options
Input JSON
The following example shows sample input JSON.
{
"quoteId": "02i3h0000009OqCAAU",
"toState": "Review",
"lastDefaultState": "Draft",
"invokeStateTransitionRules": true,
"invokeProductRules": true,
"invokeActionType": "draft",
"actionScope": "version",
"logResults": true,
"fromNoneState": false
}Output JSON
The following example shows sample output JSON.
{
"transition": true,
"transitedState": "Review",
"stateTransitionRules": {
"result": true,
"ruleDetails": [{
"result": true,
"conditions": "Quote.Status == 'Draft'",
"name": "Status is Draft",
"ruleId": "a5Q6g0000005vSPEAY",
"transitionName": "Draft > Review",
"objId": "02i3h0000009OqCAAU"
}, {
"result": false,
"conditions": "Quote.Name == 'Test'",
"name": "Name is Test",
"ruleId": "a5Q6g0000005vSPEAZ",
"transitionName": "Draft > Review",
"objId": "02i3h0000009OqCAAU"
}]
},
"productRules": {
"allFalse": false,
"trueRules": {
"Quote": [{
"ruleDetails": {
"ruleId": "a5Q6g0000005vSPEBX",
"objectId": "02i3h0000009OqCAAU",
"transitionName": "Draft > Review",
"productId": "01t6g000000RzFAAA0",
"action class": null,
"action method": null,
"message": "Name is not blank",
"conditions": "Quote.Name != ''",
"requirement name": "Name is not blank"
}
}]
},
"falseRules": {
"Quote": [{
"ruleDetails": {
"ruleId": "a5Q6g0000005vSPEBX",
"objectId": "02i3h0000009OqCAAU",
"transitionName": "Draft > Review",
"productId": "01t6g000000RzFAAA0",
"action class": null,
"action method": null,
"message": "Name is blank",
"conditions": "Quote.Name == ''",
"requirement name": "Name is blank"
}
}]
}
}
}Result Description
result Overall result of executed rules. If true, the target object is transitioned to toState. If false, the target state remains the same or transitions to the Alternate state defined on the state transition.
ruleDetails List of the executed rules and their results
This JSON includes these key/value pairs:
Key |
Value |
|---|---|
conditions |
Rule condition |
name |
Name of rule |
objId |
Object ID that rules were executed against |
result |
Result of rule condition evaluation against target quote |
ruleId |
Rule Id |
transitionName |
Name of transition associated with rule |

