How to Assign variable set variable value from client script!!

Community Alums
Not applicable

Hi All,

We have a Assignment group variable in one of ours variable sets. We want to set that assignment group variable value by default for some items (Group value will differ from different items).  

How to set that Assignment group variable (present in variable set) value to achieve above condition!!!

1 ACCEPTED SOLUTION

Hi Ganesh,

sample script below

function onLoad(){

g_form.setValue('group_variable', groupSysId);

}

Regards
Ankur

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

View solution in original post

5 REPLIES 5

Pooja Mallikarj
Kilo Sage

Hi,

You can write onLoad catalog client script for your variable from the variable set and select the applies to as Catlog item and you can select the catalog item name.

Refer the below sample code.

function onLoad() {
//Type appropriate comment here, and begin script below
g_form.setValue('assignment_group','62826bf03710200044e0bfc8bcbe5df1'); // sys id of your assignment group

}

Thanks,

Pooja M