Check Box Field enable for particular catalog task

nameisnani
Mega Sage

Hi Team ,

 

We have requirement that 

 

We have catalog called " ABC GXC " , for this catalog , 2 catalog task will trigger , 

 

our requirment is 

 

we need a check box field only for 2 nd SCTASK , when 2nd SCTASK state changes to Closed completed , that check field should be mandatory . 

 

how to achieve this requirment . 

 

Please provide us steps and screenshots for better understanding .

 

Thanks in advance 

 

 

8 REPLIES 8

Hi @nameisnani The UI Policy needs to be on your "ABC GXC" catalog item. Go to that catalog item create a variable and then UI policy to hide

Regards
Harish

Hi @Harish KM 

 

I think u are not clear about my requirement . 

 

The check Box field only for 2nd SCTASK , i mean like this 

 

nameisnani_0-1698227828657.png

 

 

what will be use creating new variable in catalog item , 

 

it has to be create only in sctask . i hope u have got clear idea

Hi @nameisnani oops sry I tot itz a variable. If it is field no UI Policy required. Just on Submit client script will do. This script will run when you hit close task UI Button and make field mandatory.

 

Script:

function onSubmit() {
var action = g_form.getActionName();// get action name of Close Task UI Action
var shortDesc = g_form.getValue("short_description"); // get value of 2nd task short description
var stateVal = g_form.getValue("state"); // get close complete state value

if (action == "close_sc_task" && shortDesc == "Task Short Description" && stateVal == 3) {
g_form.setMandatory("fieldname", true); // set variable mandatory

return false;

}
}

Regards
Harish

Ankur Bawiskar
Tera Patron
Tera Patron

@nameisnani 

you can create normal onChange client script on sc_task and on State field

Determine the short description and see if it is for 2nd task if yes then make the checkbox field mandatory when state is close complete

 

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