After adding an approval step to a workflow, the following error is thrown when attempting to save the workflow:
"This approval policy is not valid: Error - The usage area of approval procedure 'XXX-XXXXX' at step 'CCC_Workflow' does not match."
What does this error mean and what are the steps to further investigate this error?
Since the error occurs while saving the workflow, the PWODecisionRule is likely not updated to the database (DB) yet.
One method is to export the SQL insert command of the workflow with the workflow step (e.g. EX) added. See the screenshot below:
With the SQL Insert command pasted to the text file, search for the procedure name added, in this case "EX". A sample search produced the following results:
insert into PWODecisionRule (UID_PWODecisionRule , DecisionRule, UsageArea, Description , MaxCountApprover, SortOrder, UID_Task , XDateInserted , XDateUpdated , XObjectKey , XUserInserted , XUserUpdated )
values (N'ATT-PWODecisionRule-EX', N'EX' , N'A' , N'Approvals to be made externally', 1 , 310 , N'ATT-K-AttestationMakeDecisionEX', '2016-12-19 04:18:48.240', '2016-12-19 04:18:48.240', N'
ATT-PWODecisionRule-EX', N'QBM_PBufferT_ProcessInsert', N'QBM_PBufferT_ProcessInsert')
As highlighted in the insert command, the UsageArea value for this insert is 'A' instead of the expected 'I' value. The UID_PWODecisionRule value, 'ATT-PWODecisionRule-EX' also indicates the attestation EX procedure was selected instead of the expect EX procedure for ITShop ,'QER-PWODecisionRule-EX' . This means the Manager Edit Workflow tool is trying to insert an Attestation EX approval step into and IT shop work flow.
Next step is to find out why the user interface (UI) is performing this wrong selection. To do so we need to enable "Show Field definition" for Manager and check on the Condition for selecting the Approval procedures in the approval step edit window:
Out of the box, the condition value should be "((SortOrder >= 0) and (UsageArea = N'I'))" which will select PWODecisionRules with Sortorder > 0 and UsageArea value = 'I'. This is potentially due to some customization or modification which was changed.