Incident form

P1234
Tera Contributor

When the user select Incident state is "On hold" then remaining all fields should be Read only.

 

Any idea how to build this above example task.

8 REPLIES 8

Arun_Manoj
Mega Sage

Hi @P1234 ,

 

Approach: Use a Client Script (Type: onChange)

1. Script Details

  • Type: onChange

  • Table: Incident

  • Field name: state

function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == oldValue) {
return;
}

var onHold = (newValue == '3'); // Replace '3' with your actual "On Hold" state value (check sys_choice)

var fieldsToDisable = [
'short_description',
'description',
'category',
'subcategory',
'impact',
'urgency',
'assignment_group',
'assigned_to',
'priority',
'contact_type',
'location',
// Add any other fields you use
];

for (var i = 0; i < fieldsToDisable.length; i++) {
g_form.setReadOnly(fieldsToDisable[i], onHold);
}
}

 

Please mark my answer as helpful/correct if it resolves your query.

Regards,

Arun Manoj

P1234
Tera Contributor

Hi Arun,

 

Code is not working

P1234
Tera Contributor

Hi Arun,

 

When the user select state is "On hold" & on hold reason is "Awaiting Caller" then remaining fields should be read only.

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @P1234 

 

You can do it with help of UI policy, which is low code/no code. 

 

UI policy:

Condition: state = on hold

UI Policy Action:

Read only --> add field one by one.

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************