Make a field mandatory when User clicks Resolve button on incident form

rin1
Kilo Guru

Hi Experts,

Recently We had a requirement to add an additional option as 'Break Fix' to 'On Hold reason' field and a new field 'Retrieved Break Fix' on the Incident form. 

Now when the Incident state is On hold, and the On Hold reason is 'Break Fix', sometimes Users directly click on Resolve button, by parallelly filling the Resolution code and Resolution notes. How do I make 'Retrieved Break Fix' mandatory when the user try to click Resolve button.

1. I tried creating UI policy, stating the conditions and making the respective field mandatory. The mandatory field pops up on the form, but the moment when I click on Resolve buttom, the incident is getting resolved even though  'Retrieved Break Fix' is not filled.

2. Tried OnSubmit clients script also, But it doesnt work. Any suggestions/help much appreciated.

find_real_file.png

 

Thanks,

Rini

12 REPLIES 12

ersureshbe
Giga Sage
Giga Sage

Hi,

You should write the UI action to achieve this.

https://your instacne name/nav_to.do?uri=%2Fsys_ui_action.do%3Fsys_id%3D38c073d7465762820116c37c3353540f%26sysparm_record_target%3Dsys_ui_action%26sysparm_record_row%3D1%26sysparm_record_rows%3D7%26sysparm_record_list%3DnameCONTAINSResolve%255EORDERBYDESCsys_updated_on

 

find_real_file.png

Please mark as  correct answer if it helped.

Regards,

Suresh.

Regards,
Suresh.

Thank you for the reply, It would be great if you could help with me the steps.

 

Kind regards,

Rini

Hi,

Can you refer below link to throw the error mssage to fill the field value.

https://community.servicenow.com/community?id=community_question&sys_id=2c35cb6ddbd8dbc01dcaf3231f9619ec

if(Retrieve Break  == null ||Retrieve Break  == 'none'){ //configure the correct field name

gs.addErrorMessage("Retrieve Break Fix should be filled up");

}

Please mark as correct answer if it helped.

Regards,

Suresh

Regards,
Suresh.

Should I update this code in the 'Resolve' UI action?  I tried it, but it doesnt work.

 So now I have included one more field to the form. I have written a client script like, when the state is Resolved and the Break Fix is 'Yes', Retrieved Break fix field should become mandatory. But no luck, it dint work either. Do you have any idea why it doesnt work or Am I updating in a wrong way.

find_real_file.png