- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-30-2024 02:34 AM
Hi,
There is OOB Ui action for interaction table "Close". when we click on that close button it needs to make "assigned to" mandatory.
can anyone let me know, how can i make changes on here.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-30-2024 03:40 AM
Please remember this is an OOB UI Action and if you update it then during upgrade it will be skipped
is it for native or workspace that you want to make it mandatory?
Client Script:
function closeInteraction() {
if(g_form.getValue('assigned_to') == ''){
g_form.addInfoMessage('Please fill assigned to');
g_form.setMandatory('assigned_to', true);
return;
}
var dialog = new GlideModal("close_confirmation");
var msg = getMessage('Confirmation');
dialog.setTitle(msg);
dialog.setPreference("sys_id", g_form.getUniqueValue());
dialog.render();
}
Workspace client script:
function onClick(g_form) {
getMessage("Are you sure you want to close this interaction?", function(msg) {
if (g_form.getValue('assigned_to') == '') {
g_form.addInfoMessage('Please fill assigned to');
g_form.setMandatory('assigned_to', true);
return;
}
g_modal.confirm(getMessage("Confirmation"), msg, function(confirmed) {
if (confirmed) {
g_form.setValue('state', 'closed_complete');
g_form.save();
}
});
});
return false;
}
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-30-2024 02:35 AM
You can add code in UI action or better create a UI policy on interaction table where state = Closed and make assigned to mandatory.
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-30-2024 02:37 AM
Hi @Dr Atul G- LNG
i tried ui policy, but its not working when we click on close button.
I try to add the code on the UI Action, that is also not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-30-2024 02:38 AM
could you please share both codes snippet.
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-30-2024 02:47 AM