- How can I trigger workflow using Business rule?
- How to create a Business rule to initiate workflow on a custom MDF object.
- What are different ways trigger a workflow on an MDF objects?
- Deletion of the data in MDF object does not trigger the workflow process.
Image/data in this KBA is from SAP internal systems, sample data, or demo systems. Any resemblance to real data is purely coincidental
- SAP SuccessFactors HXM Suite
- Metadata Framework (MDF)
Reproducing the Issue
Background: Workflow can be set using two ways:
A) Using "Workflow Routing" property on the object level.
B) Dynamically through scenario based business rule, where customer will set 'wfConfig' property of an Object Definition.
Prior to 1902, wfconfig was shown in Basic Rules.
In 1902, we implemented New Rules scenarios where the wfConfig property was not shown in Basic or New MDF Scenarios when creating a rule.
Because of the above change, the customers were not able to Edit the Basic Rule or add a New wfConfig to the existing Rule and workaround for this was to create a New Rule Scenario with Workflow purpose.
In few cases of complex Rules which needed Edit and addition of wfconfig, this created a problem. So to prevent this we need to adopt the API developed by Rules Engine Team in 1905 to:
-Show wfconfig in Basic Rules
-Hide wfconfig in new MDF Rule Scenario based rules.
Post 1905 behavior should be as below:
- When creating or Editing Basic Rules for MDF Object, user should be able to see the wfConfig property.
- User should be able to set the wfConfig in Basic Rule and the Rule should be executed successfully.
- When creating a new MDF Rule Scenario, the user should not be able to see wfconfig when creating/editing for any purpose except for Workflow.(Must select ‘Workflow’ as Purpose).
- Then further choose like below:
5) This rule has to be further configured on the "Save Rules" section of the object.
1) In case Pending data has been set to Yes => The save rules on the object level trigger twice. First when the initiator creates the data and secondly when the last approver of the workflow process finally approves the data.
If you have a requirement as per which you do not want the rule to trigger twice or want to limit the rule execution at only one event ==> You need to do that by providing "if-else" conditions in the rule.
Example: If you want the rule to be triggered only by approver at the end and not when the initiator creates the data - You should put condition like below in the rule:
If LoginUser() = UserID
then perform calculations
2) If you're setting the workflow via "Workflow Routing" => It automatically triggers at the Save event and also on the Delete event (when you save and delete the data in MDF object respectively).
But if you're setting the workflow via business rule then it will trigger only on the save event. If you want the workflow process to be triggered also on the delete event => Then you have to configure the same workflow rule on the "Delete Rules" section of the object as well.
MDF, Metadata Framework, MDF Workflow, MDF Business Rule, wfConfig, Scenario Based rule, Basic Rule, custom MDF, workflow routing, wfconfiguration , KBA , LOD-SF-MDF-WFL , Custom Object based Workflows , LOD-SF-MDF-RUL , Custom Oject based Business Rules , How To