Symptom
How to use a business rule to validate if an attachment has been added, and if not, raise an error message asking to do so?
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 Employee Central
Resolution
In this example, we'll consider the attachment field in National ID Information portlet. You can use similar logic for other portlets where attachment is supported and configured in your instance.
- Go to Admin Center > Configure Business Rules
- Expand Employee Central Core
- Select Validate HRIS Elements
- Enter Rule Name, Rule ID and select the Base Object National ID Information Model
- Configure IF where National ID Information Model.Attachment.Value is equal to Null Then Raise a message. The message can be configured in Manage Data > Message Definition.
- Add the rule in BCUI > National ID Information with onSave Event Type
- Save
The rule works fine, however, the rule trace on Employee Time Attachment will have values such as:
'The expression 'EmployeeTime.cust_attachment' could not be evaluated completely as the property 'cust_attachment' of 'EmployeeTime' is found to be NULL at 'EmployeeTime.cust_attachment'. Evaluation result is NULL.'
The attachment field does not store a value you can compare per say. It is storing a file!
Therefore there is no "value" you can compare with - hence why the Rule Trace will tell you - "The expression 'EmployeeTime.cust_attachment' could not be evaluated completely as the property 'cust_attachment' of 'EmployeeTime' is found to be NULL at 'EmployeeTime.cust_attachment'. Evaluation result is NULL."
All it is saying here is that it could not "completely" evaluate all the data returned when checking this field (as data such as personId, userId, attachment-id, timestamp, XYZ other info is returned) - but it correctly validated that the field is NULL and serves the purpose.
The above apply in all areas where adding attachment is possible.
NOTE: You must use the option Null available to be selected in drop down in the business rule configuration and not a text as Null (It's not possible enter a Text value if the scenario Validate HRIS Elements is selected; however it was possible to enetr Text values for Basic scenario).
See Also
2093378 - National ID validation issues - Employee Central
2092849 - How to create a Business Rule to validate data on change/save, and provide a Warning or Error message
Keywords
could not be evaluated completely, if attachment is null, make attachment mandatory, Attachment required, rule, file, compulsory, allow, prevent, national id information, personal information, job information, required, error, warning, message, raise, validate, validation , KBA , LOD-SF-EC-JOB-RUL , Job Info Business Rules , LOD-SF-EC-PER-NAT , National ID - Config, Rules, RBP, UI , LOD-SF-EC-CMP-RUL , Business Rules , LOD-SF-EC-PER , Person Data (All Person Data Types) , How To