
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-10-2020 02:50 AM
I am new to Service Now. I have been assigned a task in which in the first step I need to create a UI action on an incident table and I have done it. The second step includes setting the additional comments mandatory on clicking the UI action and deliver a field message reading: "Please add additional information".
Kindly help me completing my SNOW task.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-10-2020 05:31 PM
Salam Abdul,
Your Question title and question description is contradicting. UI action and UI policy are two different things. So, I am going by question description and this is your code to make additional comments field mandatory and showing the field msg using UI action
Make sure client checkbox is "checked", action name is "mandatory_comments" & onClick is "reopen()"
//Client-side 'onclick' function
function reopen(){
if(g_form.getValue('comments') == ''){
//Remove any existing field message, set comments mandatory, and show a new field message
g_form.setMandatory('comments', true);
g_form.showFieldMsg('comments','Please add additional Information.','error');
return false; //Abort submission
}
//Call the UI Action and skip the 'onclick' function
gsftSubmit(null, g_form.getFormElement(), 'mandatory_comments'); //MUST call the 'Action name' set in this UI Action
}
Please mark this correct & helpful if it answered your question.
Thanks & Regards,
Sharjeel
Muhammad

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-13-2020 01:06 AM
It is not working. It is submitting the form and then redirecting me to the list view of incident table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-13-2020 01:15 AM
Hi ,
Can you share your code?
Did you use correct action name in the code?
Thanks,
Pooja M
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-13-2020 01:51 AM
Hi,
I think you mentioned that it is working fine.
Are you still looking for solution for this?
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-13-2020 05:17 AM
Hello,
I have got a solution to my problem. Thank you for asking.
Regards:
Abdul Ahad
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-16-2021 07:38 PM
Hi Ankur,
I have a similar requirement but on a different UI Action.
We have a OOB UI Action named "Create Request" on incident module.
As soon as the button is clicked the state changes to "Cancelled" and redirects to service catalog homepage.
Is there a way to make amendments to change the state only when the request has been submitted successfully?
Regards,
Surabhi