Make Worknotes mandatory in UI Action
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-23-2024 01:34 AM - edited ‎09-23-2024 07:11 PM
I have one button on Form 'Transfer Case' which calls UI Page, Now I want to make worknotes mandatory if user is transferring case.
I'm able to make worknotes mandatory but once user put something as worknotes and then again click on UI action, system says changes will not saved in the form.
I want first worknotes to be saved and then it should call UI Page script.
var workNotes = g_form.getValue('work_notes');
if (workNotes == '') {
g_form.setMandatory('work_notes', true);
g_form.addErrorMessage('The following mandatory fields are not filled in: Work Notes (Internal)');
return;
}
if (workNotes != '') {
var sysId = g_form.getUniqueValue();
var dialogClass = GlideModal ? GlideModal : GlideDialogWindow;
var dialog = new dialogClass('sn_hr_core_Transfer Case');
dialog.setTitle(getMessage('Transfer Case'));
dialog.setPreference('sysparm_sys_id', sysId);
dialog.setPreference('sysparm_table_name', g_form.getTableName());
dialog.setPreference('sysparm_subject_person', g_form.getValue('subject_person'));
dialog.render();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-29-2024 08:27 AM
Hello @IAmIshan,
Please refer to the link below:
https://www.servicenow.com/community/developer-forum/making-work-notes-mandatory-when-transferring-a...
If it is helpful, please mark it as helpful and accept the correct solution. In future, it might be helpful for someone to refer to this solution.
Thanks & Regards,
Abbas Shaik