Skip to Content
Technical Articles
Author's profile photo Xavier Le Garrec

Custom validation to prevent a promotion increase without actual job promotion

Overview 

In the model company design of the promotion section of a compensation/salary planning worksheet nothing prevents a planner from entering a promotion increase ($ amount) without actually selecting a new Job Classification for an employee from the “Promote” popup.

 

Reason for this topic / Problem :

For data consistency purposes customers may want to only allow planners to save a promotion increase for an employee once that employee’s Job Classification has been changed in the “Promote” tool.

However there are no standard columns or features that capture this requirement.

 

 

Solution 

We need to add a new custom column in our template next to the promotion recommendation column and configure a custom validation formula in it as per the screenshot below.

 

 

After the worksheet is launched a planner who entered a promotion increase before using the “Promote” popup will get the following messages on mouse-over and on save :

 

 

 

Conclusion

Custom validations can contain complex formulas but are limited as of 2H 2023 to 20 columns in Compensation and Total Compensation templates only (they are not supported in Variable Pay yet).

As a workaround to this 20 columns limit we can use the instructions tab of a worksheet to display an unlimited number of warning or error messages (workaround designed by Skip Jones from SAP below). As of 2H 2023 the Instruction tab can be relabeled by template which makes this design easier for customer with large numbers of errors or very long error messages.

 

 

All materials in this article were inspired by recent implementations that are now live. Please highlight if you see anything that needs to be corrected or if you have encountered easier ways to meet customer requirements on this particular topic.

 

 

 

 

All the best,

Xavier

 

 

 

(If you found this blog useful please consider giving it a Like)

 

Appendix 

For consultants with provisioning access, please find below the promotion custom validation column code snippet below :

 

<comp-field-definition id="customValidationPromotion" isCustomField="true" isVisible="true" type="string" useFor="salary" readOnly="true" hidePercentage="false" hideAmount="false" percentageReadOnly="false" reloadable="false" displayOrder="38">
<comp-field-label><![CDATA[]]></comp-field-label>
<comp-custom-field-formula><![CDATA[if(finPayGrade=payGrade && promotion > 0,"*","")]]></comp-custom-field-formula>
<comp-custom-validation validationType="hard">
<comp-custom-validation-formula><![CDATA[if(finPayGrade=payGrade && promotion > 0,"false","true")]]></comp-custom-validation-formula>
<comp-custom-validation-warning>
<comp-custom-validation-warning-title><![CDATA[Please promote the employee using the Promote tool (3 dots next to employee's name) before entering a $ amount.]]></comp-custom-validation-warning-title>
<comp-custom-validation-warning-message><![CDATA[Please promote the employee using the Promote tool (click on the three dots next to the employee name) before entering a $ amount.]]></comp-custom-validation-warning-message>
</comp-custom-validation-warning>
</comp-custom-validation>
</comp-field-definition>

 

 

 

Assigned Tags

      12 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Gurusimran Singh
      Gurusimran Singh

      Xavier, can we handle the following scenario as well:

      When any employee gets promoted in promotion screen, planner should enter some amount in promotion column on the compensation worksheet. Can we add a validation to not allow the planner to save the worksheet without entering amount in promotion column?

      Author's profile photo Xavier Le Garrec
      Xavier Le Garrec
      Blog Post Author

      Hi Gurusimran, yes to do what you are describing you can use the custom validation solution explained in this article but change the formula to be as per the screenshot below :

       

       

       

       

      Author's profile photo Gurusimran Singh
      Gurusimran Singh

      Thanks, Xavier Le Garrec.

      Author's profile photo Sreekanth Reddy
      Sreekanth Reddy

      Hello Xavier

      My requirement:

      When any employee gets promoted in promotion screen, planner should enter some amount in promotion column on the compensation worksheet. Can we add a validation to not allow the planner to save the worksheet without entering amount in promotion column?

      I tried with the configuration you mentioned, but not working as expected.

      Thanks

      Sreekanth

       

      Author's profile photo Xavier Le Garrec
      Xavier Le Garrec
      Blog Post Author

      Hi Sreekanth,

      Yes that is possible, please see my screenshots in my answer to Gurusimran above.

      Thank you

      Xavier

      Author's profile photo Xavier Le Garrec
      Xavier Le Garrec
      Blog Post Author

      And here is the xml code snippet for the column for what you are trying to do :

      <comp-field-definition id="customValidationPromotion" isCustomField="true" isVisible="true" type="string" useFor="salary" readOnly="true" hidePercentage="false" hideAmount="false" percentageReadOnly="false" reloadable="false" displayOrder="38" reportable="true">
      <comp-field-label><![CDATA[]]></comp-field-label>
      <comp-custom-field-formula><![CDATA[if(finPayGrade!=payGrade && promotion = 0,"*","")]]></comp-custom-field-formula>
      <comp-custom-validation validationType="hard">
      <comp-custom-validation-formula><![CDATA[if(finPayGrade!=payGrade && promotion = 0,"false","true")]]></comp-custom-validation-formula>
      <comp-custom-validation-warning>
      <comp-custom-validation-warning-title><![CDATA[Please promote the employee using the Promote tool (3 dots next to employee's name) before entering a $ amount.]]></comp-custom-validation-warning-title>
      <comp-custom-validation-warning-message><![CDATA[Promotion increase is mandatory when an employee is promoted through the Promote tool.]]></comp-custom-validation-warning-message>
      </comp-custom-validation-warning>
      </comp-custom-validation>
      </comp-field-definition>

      Author's profile photo Sreekanth Reddy
      Sreekanth Reddy

      Thank you so much Xavier. The code is working correctly now.

      But when we hide/remove change/view permission on the worksheet, this validation is not working. Can we make this work even when the field is hidden/not visible on the worksheet.

      Thanks

      Sreekanth

      Author's profile photo Xavier Le Garrec
      Xavier Le Garrec
      Blog Post Author

      Hi Sreekanth, I am not sure I understand. Which field are you hiding ? Thank you

      Author's profile photo megha sadhotra
      megha sadhotra

      Hi Xavier Le Garrec,

       

      Could you please elaborate on another product feature of SF Compensation Promotions, which was released recently in H1 2020 - Expanded Pay Range Matching for Promoted Employees.

      It talks about using getting the final pay ranges based on new data for the promoted employees. Can you suggest which field can be used here? Can I use Final Pay Grade?

      Thanks,

      Megha

      Author's profile photo Ruben Schultz Beeck
      Ruben Schultz Beeck

      Hi Xavier,

      Have been using custom validation a few times now in solutions for different customers. Now I have a scenario where I would need to create custom guidelines as standard guidelines is not supported in this case as no standard fields are include.

      I have three bonus plans with each Min/Default/High values. I wonder if I can use your example above for this purpose. Do you believe this is doable?

      Thanks

      Ruben Beeck

      Author's profile photo Xavier Le Garrec
      Xavier Le Garrec
      Blog Post Author

      Hi Ruben,

      There is a technical and a functional answer to your question.

      Technically the answer is Yes. It doesn't seem to me like there are things we cannot build with custom validations. We could totally create custom guidelines for a customer and use custom validations to enforce them.

      Functionally speaking I would try to prevent this as much as I can. A little bit for myself to not have to struggle building something extremely complicated (even though I quite enjoy it) but first and foremost for the customer because it will be incredibly hard to maintain over the years. And we want our customers to "own" SuccessFactors once we roll out of implementations and be able to have them do the maximum of things by themselves.

      If you provide more details on why you think it is not doable with standard guidelines, maybe we'll find creative ideas (integration with MDF or other).

      Thanks !
      Xavier

      Author's profile photo Xavier Le Garrec
      Xavier Le Garrec
      Blog Post Author

      Adding an additional testing scenario about whether to use != or =! for this kind of rules : the answer is that only != is supported.