Problem The field BusinessObject.Fieldname must be filled in before the record can be saved
When using an Automatic Action in the CSM Portal that is set up to run before save, the action won't run before saving the record and you get an error.
Summary of error scenario:
- A new field has been added to a Business Object and Required for Save selected in Field Properties.
- An automatic Save action was added to the Business Object and Execute before saving record was selected.
- A One-Step™ Action was created with an Update Business Object step where the newly created field was updated.
- In the CSM Portal an Incident was submitted. You see this error:
The field [Business.Object].[Field] must be filled in before the record can be saved.
Solution: Put validation inside the Automatic Action or ensure that users can complete required fields before saving
Here, the system is configured to require that a field be saved, so that implies that the field must be filled out by the user before they select the Save button. This is protection that CSM provides to prevent the entry of bad data.
Validation for required fields happens when the Save button is selected (or the Save command is triggered). This happens before any Automatic Actions have the chance to run. Automatic Actions do not occur prior to this validation, even if the Execute before saving record check box is selected. So the flow of events is as follows:
User selects Save -> Validation occurs -> Automatic Action runs -> Record is saved.
If you have a field that is not accessible by the user, and it is being populated in some other way (example: by using an Automatic Action), then by making this field required you are risking a poor user experience. So, best practice in this case, would be to handle that inside the automatic action by checking if the field's value is what is expected, and going back to the user if it isn't.
- If a field is inaccessible to the user, making it required may result in a poor user experience. It will also limit their ability to fill in the required field, and as a result prevent them from saving the record. To prevent this happening, perform any validation inside of the Automatic Action.
- If a field is required for save, it is best practice to have the field accessible to the user so they can fill it in before saving the record.