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

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Ganesh,

you can have client script which applies to variable set

in the onload client script you can check the catalog items; if it is ABC or XYZ then you can set the default value

Regards
Ankur

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

Community Alums
Not applicable

Hello Ankur,

Could you please provide me sample if condition code!!

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

Ashutosh Munot1
Kilo Patron
Kilo Patron

Hi,

You need a onload client script in each catalog item to do this and then use simple code:

 

g_form.setValue('assignment_group','sys_id');


Thanks,
Ashutosh