make a field mandatory when clicking on a ui action
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-04-2025 04:21 AM
Hi community, the client asked me for the following configuration: in the demand form, when clicking on the "approved" button he wants certain fields, for example due date (requeted_by) to ask it as mandatory and the flow not to continue. What is the best way? Ui_Policy combined with Client_scripts? Business rules? modify Ui_action? I read them! Thank you very much
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-04-2025 04:28 AM
Hi @Daiana Botta ,
Approve button is visible when state are state == -4 || state == 10, so best solution would be, you can create ui policy to make the filed mandatory on both state.
-------------------------------------------------------------------------
If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.
Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay
-------------------------------------------------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-04-2025 05:03 AM
it really depends on what customer wants.
Is that "Approved" button on your table? share your screenshots.
1) UI action - can be client side and error message can be shown
2) Business rule - before update with valid condition, it will run before updating the record and you can show error message
3) Client script - you will have to create onChange on correct field and check if the fields are filled or not.
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
‎02-05-2025 08:37 PM
Hope you are doing good.
Did my reply answer your question?
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
‎02-18-2025 10:20 AM
Hi @Ankur Bawiskar I'm involved with the same client.
They need to check if these fields are completed before to change the state from qualified to approved.
Why have not we considered a simple UI policy? Because the ui policy will be activated even when they do 'save' or 'update'. They just need to check the fields ONLY for the state change
Is there any way to limit the ui policy behaviour only for states changes or we should work directly on the approved UI action?
