make a field mandatory when clicking on a ui action

Daiana Botta
Tera Contributor

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

5 REPLIES 5

Runjay Patel
Giga Sage

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

-------------------------------------------------------------------------

Part 2. In this video i have talked about overview on ServiceNow platform/tool. How you can opt for personal dev instance (PDI)? how to login in ServiceNow instance and navigation to OOB modules. For document please visit: https://servicenowwithrunjay.com/ Follow Facebook page for latest update on

Ankur Bawiskar
Tera Patron
Tera Patron

@Daiana Botta 

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.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

@Daiana Botta 

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.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

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?