Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

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

Harish KM
Kilo Patron
Kilo Patron

Hi @nameisnani Create a variable . Hide this variable only for catalog form using UI Policy.

Write a onSubmit type client script on Catalog task table with below script:

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("variables.variablename", true); // set variable mandatory

return false;

}
}

 

Regards
Harish

Hi @Harish KM , 

thxs for quick response

 

could u please provide steps of UI Policy and Client script for better understanding

Hi @nameisnani 

Create UI Policy Like below

HarishKM_0-1698226930525.png

 

2. Write onsubmit client script on sc_task table

HarishKM_2-1698227070121.png

 

 

 

Regards
Harish

@Harish KM 

 

which table i need to select 

 

nameisnani_0-1698227258324.png