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.

client script

Gaurav69
Tera Contributor

If serviceline(selectbox type) is 'D/C HQ Deposit, set field Catalog item(reference type) as - HQ Deposit Management

1 ACCEPTED SOLUTION

Vrushali  Kolte
Mega Sage

Hello @Gaurav69 ,

 

You can easily achieve this requirement by creating an on change client script on serviceline field as below -

 

VrushaliKolte_0-1721726291054.png

 

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

   //Type appropriate comment here, and begin script below

  if(newValue == 'D/C HQ Deposit'){
   g_from.setValue('Catalog item','sys_id_of_HQ Deposit Management'); //pass sys_id of catalog item
  }
   
}

 

 

Please make sure you are using correct field names while configuring the client script.

 

If my answer solves your issue, please mark it as Accepted ✔️and Helpful 👍!

View solution in original post

1 REPLY 1

Vrushali  Kolte
Mega Sage

Hello @Gaurav69 ,

 

You can easily achieve this requirement by creating an on change client script on serviceline field as below -

 

VrushaliKolte_0-1721726291054.png

 

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

   //Type appropriate comment here, and begin script below

  if(newValue == 'D/C HQ Deposit'){
   g_from.setValue('Catalog item','sys_id_of_HQ Deposit Management'); //pass sys_id of catalog item
  }
   
}

 

 

Please make sure you are using correct field names while configuring the client script.

 

If my answer solves your issue, please mark it as Accepted ✔️and Helpful 👍!