Redirect to details tab when mandatory fields missing when clicking on save in SOW on change request
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hello Everyone,
I have a requirement on the Change Request form in Service Operations Workspace.
When a user clicks the Save button after filling in only the fields available on the Overview tab, there may still be mandatory fields present on the Details tab that have not been completed.
The expected behavior is:
- Prevent the record from being saved/submitted.
- Automatically redirect the user to the Details tab.
- Highlight the missing mandatory fields.
- Display an appropriate validation message indicating that required fields must be completed before saving.
Has anyone implemented a similar requirement or can suggest the best approach to achieve this in Workspace?
Thanks in advance for your help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
I'm assuming the fields are not literally configured to be mandatory which is why they can save the record without filling in those fields. I would be careful about doing that anyway.
What I'm guessing needs to be done is configure the change model. The model states can be configured such that going from one state to another is conditional. Automatic state transitions will happen once conditions are met so they won't set fields as mandatory, but manual state transitions allow you to make fields mandatory when the state is changed.
- Open the Change Model
- Open the Model State you want to manually transition from
- Open or create a State Transition
- Ensure Automatic transition is false
- Open or create a Transition Condition
- Ensure Requires is set to Mandatory Fields
- Create the Model State Transition Condition Fields to indicate which fields are mandatory before transitioning from one state to another
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
This can be achieved in Workspace with a combination of Workspace Client Scripts and form validation.
Steps:
- Create a Workspace Client Script (onSubmit) on the Change Request table.
- Validate the mandatory fields that reside on the Details tab.
- If any required field is empty:
- Return false to prevent the save.
- Display a form error message using g_form.addErrorMessage().
- Programmatically switch the user to the Details tab.
- Set focus to the first missing field using g_form.getControl() / Workspace APIs.
- The mandatory indicators will then be visible on the Details tab, guiding the user to complete the missing fields.
function onSubmit() {
if (!g_form.getValue('implementation_plan') ||
!g_form.getValue('backout_plan')) {
g_form.addErrorMessage(
'Please complete all mandatory fields on the Details tab before saving.'
);
// Set focus to missing field
g_form.activateField('implementation_plan');
return false;
}
return true;
}
Thanks and Regards,
Alok
