Symptom
- Workflow not getting triggered when adding MDF entries via API call
- Workflow on business rules not getting triggered on MDF when creating data via API call
"Image/data in this KBA is from SAP internal systems, sample data, or demo systems. Any resemblance to real data is purely coincidental."
Environment
- SAP SuccessFactors HCM Suite: Odata API
- SAP SuccessFactors HCM Suite: Metadata Framework
- SAP SuccessFactors HCM Suite: Business Rules
- SAP SuccessFactors HCM Suite: MDF Workflows
Reproducing the Issue
- Add a business rule that will trigger a workflow on the MDF Object
- Create new entries via Odata API Call
- Check the data created for a pending workflow approval request
Cause
If the user creating the entry for the MDF object via API call has access to Admin access to MDF OData API granted, then as per the standard behavior for the admin users Workflow execution will be skipped.
Resolution
When an MDF object is associated with a workflow and if an instance is created via OData API, the workflow may not be triggered and this is a expected behavior if the user is MDF OData Admin .
- If the user if MDF OData Admin workflow won't be triggered.
- If the user not MDF OData Admin workflow will be triggered.
This is controlled in MDF OData layer. When creating a MDF entity via Odata API the workflow is called, but gives the follow error message:
<code>COE_GENERAL_BAD_REQUEST</code>
<message lang="en-US">In order to trigger workflow, please set the 'workflowConfirmed' flag to true!</message>
This is because there is a step which has been skipped. When the user does a manual trigger from the UI, there's a pop-up for workflow and user must confirm that.
Correspondingly in Odata, workflowConfirmed should be set as true to simulate that operation. Since MDF Workflow can be triggered generically on any MDF entity, every MDF OData entity has this parameter. The above error message will not happen if the requester set 'workflowConfirmed' flag to true
Follow the steps below to check if the user is a MDF Odarta Admin:
- Login to the instance and navigate to Manage Permission Roles
- Go to the assigned Permission Role for the user that is making the API call
- Navigate to Administrator Permissions category --> Metadata Framework
Keywords
MDF, Metadata Framework, Odata API, Business Rules, Workflows, API call , KBA , LOD-SF-INT-API , API & Adhoc API Framework , LOD-SF-MDF-API , OData APIs & Integrations , Problem