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

Hi @sureshloganathan 

So finally its working now, Retrieved Break Fix field type was True/False. WHen I updated the type to choice, Bingo It worked!

Thanks for your reply 🙂

 

KR,

Rini

Raghu Ram Y
Kilo Sage

Hi @rin

1. Navigate to "System Policy -> Data Policy"

2. Open "Make close info mandatory when resolved or closed" Data Policy

3. Scroll down and go to "Data Policy rules like below screenshot"

find_real_file.png

4. Click on New and add your field, make it as mandatory.

I hope it helps you, if so please mark my response as helpful and correct.

Thank you for the reply. It works same like UI policy. If I implement this way, 'Retrieved Break Fix' field is made mandatory for all type of incidents.

I just want to make sure that, when the On Hold reason is 'Break fix' the User doesn't Resolve the incident unless 'Retrieved Break fix' is filled. 

find_real_file.png

shloke04
Kilo Patron

Hi @rin

In order to achieve this requirement, you need to modify the Resolve button code. What you have to do here is when User clicks on Resolve button on the client side of Resolve button you need to make the field "Retrieved Break Fix" as mandatory which you want.

So please use the script below which I have modified for OOB Resolve button and you need to do the same as well:

var getState = g_form.getValue('state');
	if(getState == '3' && g_form.getValue('hold_reason') == 'Value of Break Fix Choice replace here'){
		g_form.setMandatory('Field Name',true); //Replace the Field Name which you want to make mandatory
	}
	

Sharing the screenshot as well for reference how you need to make this change:

find_real_file.png

This is working for me in my PDI.

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

Hi @shloke04 - I was hoping you would be able to help me with a similar issue if possible please.

 

We would like to make the 'resolution notes' field mandatory when an agent tries to press the 'Resolve' UI action we have on the customer service case table. So that when an agent tries to press the button, the state stays the same, and they are prompted to complete the resolution notes field, before they can resolve the case.

We also want this functionality in workspace.

I am new to development, can you help me, with what I script I am required to add, to get this functionality please.

I have added screenshots of our current UI action, which includes your script you provided too.

 

JHughes62_0-1692009246261.png

 

JHughes62_1-1692009283186.png