SAP Knowledge Base Article - Public

2993166 - OnSave Business Rules are triggered twice in case of workflow update - Employee Central

Symptom

  • OnSave Business Rule is used to update to Base Salary pay component based on Job Information changes.
  • The change to specific fields in Job Information triggers a workflow. If no updates are made to the workflow during the approval process, the new value is set correctly by the rule. However, if one of the approvers with permission to edit the workflow makes any Update to the workflow request, the rule triggers for a second time, resulting in double the increase/decrease to the base pay component amount.

Environment

  • SAP SuccessFactor HXM Suite
  • Employee Central

Cause

It is expected behavior that onSave rules are triggered again when a workflow is updated. The rule uses the current amount to recalculate the new value when the workflow is updated. This will be repeated as many times as the workflow is updated. Reason is, there could be additional changes made for the second time, so the onSave rules are triggered again to do the calculations as per new changes.

Resolution

  • In some scenarios, it may change the amount twice, however, it is not possible to stop these rules from executing.
  • Some alternatives can be considered:

    a) Change the workflow configuration in "Manage Organization, Pay and Job Structures", setting the "Edit Transaction" to "No Edit". In this way, the users would have to withdraw the workflow request and then re-submit it to be able to make amendments to it, which will prevent the rule from recalculating the Base Salary amount multiple times.
    b) When the approver is updating the workflow, they should reset the amount on pay component to old value. Then when the onSave rule is triggered, it is correctly calculated based on the old value.
    c)Configure a custom field which will be used to determine if the onSave rule for example “Pay Component Change_onSave Rule” will be executed or not.

Steps to implement option c)Configure a custom field which will be used to determine if the onSave rule for example “Pay Component Change_onSave Rule” will be executed or not:

  1. Create a new custom field for example “FTE Change_field” with a yesNo picklist in Job Information

    2. Create an onChange rule for example “Set FTE Change_rule” to be triggered on a specific field which is used in the trigger of the onSave rule “Pay Component Change_onSave Rule”  for example the FTE field.
    This always true rule will set the new custom field “FTE Change_field” to Yes when the FTE value is changed.

    3. Add an extra if condition to the original onSave rule “Pay Component Change_onSave Rule” to check if the custom field “FTE Change_field” is Yes.

    4. Create an new onSave, always true rule for example  “Reset FTE Change_onSave Rule” set the custom field “FTE Change_field” to No. 
    This rule must be triggered after the original onSave rule “Pay Component Change_onSave Rule”

    Outcome: 
  • When the user original makes the change the custom field “FTE Change_field” will be set to Yes.
  • The onSave rule “Pay Component Change_onSave Rule” will be executed and update the pay component.
  • The new onSave rule “Reset FTE Change_onSave Rule” triggers and resets the custom field “FTE Change_field” to No.
  • When a user now updates the Workflow, when the changes are saved.
  • The custom field “FTE Change_field” is still set to No and so the original onSave rule to update the pay component “Pay Component Change_onSave Rule” will not be triggered as the if condition checking if the custom field “FTE Change_field” is equal to Yes will not pass. 

Keywords

ECT-79979, workflow, onsave, business rule, update, triggering twice, pay component, base salary, value, amount , KBA , LOD-SF-EC-WFL-TOL , Admin Tools, Pending Req, Admin Alerts, Check Tool , Problem

Product

SAP SuccessFactors HCM suite all versions