- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2014 01:03 AM
Hi SNC,
I have a UI button which refers to a certain action (example: Reject) and I want when someone clicks this UI button, that he receives a message to fill a field before anything else happens. I know I could do a UI policy where I can make the field mandatory, but if I make it mandatory I have to use a condition based on state and I don't want to do this because in this state I have another UI buttons on the form like Approve, Publish, etc.
Is there a way I can say that the field will become mandatory only when a specific button is pressed?
Thanks in advance.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2014 01:14 AM
Hi Dimitar,
You can refer to the second script in this guru link, I guess this is what you are looking for:-
http://www.servicenowguru.com/system-ui/ui-actions-system-ui/client-server-code-ui-action/
Regards,
Hari
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2014 01:09 AM
Hi Dimitar,
Upon clicking the UI Action button, you can set a Flag field value to true.
This Flag field need to be on the form, but you can hide this field unconditionally using a UI Policy.
Now using another UI Policy you can set any other field Mandatory on the basis of your Flag field turning True.
Hope this helps.
Thanks,
Subhajit

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2014 01:13 AM
Hi Dimitar,
I suggest you can write a On Submit client script like
var ex = g_form.getActionName();
if(ex == 'Reject'){
g_form.setMandatory('field',true);
}
Let me know if you have any question.
Regards,
Sunil Babu Safare.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2014 01:14 AM
Hi Dimitar,
You can refer to the second script in this guru link, I guess this is what you are looking for:-
http://www.servicenowguru.com/system-ui/ui-actions-system-ui/client-server-code-ui-action/
Regards,
Hari
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2014 01:28 AM
Harikrishnan Vijayanabsolutely what I was looking for! Thanks a lot!:)