How to get sys_id of assignment group of cmdb records and show it on another field.

Gudu
Tera Contributor

Hi Team,

I am trying to show the sys_id of assignment groups which comes from cmdb app table. Below is the catalog item form 

 

Gudu_0-1755699500452.png

Here when i select any of the choices on please select option , it is populating the values of each field on above readonly field. 

Here you can see the deprovisioning servicenow queue name is basically assignment group.

 

I am able to autopopulate the data when we select the cmdb applicaiton. (it is referencing to cmdb_ci_appl) table. 

 

Now i am having requirement to show the sys_id of assignment group which is here de-provisioning servicenow queue name in the variables of catalog item section. 

 

For this i have created another field called deprovisioning queue sys id which is hidden on the form. 

and this field should show the sys_id of assignment groups of each record of cmdb_ci_appl table and show this on catalog form variable section. 

 

Kindly help here.

 

4 REPLIES 4

GlideFather
Tera Patron

Hi @Gudu,

 

do you want to have it populated after the change in the CMDB App field?

Write a catalog client script, type on Change and fetch the sys ID by a script. I didn't understand what value do you want to get exactly..

———
/* If my response wasn’t a total disaster ↙️ drop a Kudos or Accept as Solution ↘️ Cheers! */


Gudu
Tera Contributor

Hi GlideFather,

Thank you for quick resopnse. 

Yes when user selects cmdb app filed , the sys_id of gourp also should autopopulate on the field deprovisioning serviceow queue sys_id field which is hidden here. 

You can easily make this work by following below threads, it's simple thing to do hence sharing code would not help you.

https://www.servicenow.com/community/guided-learning-itsm/i-want-to-auto-populate-the-user-details-b...

https://www.servicenow.com/community/itsm-forum/how-to-auto-populate-email-id-of-user-in-email-field...

https://www.servicenow.com/community/developer-forum/how-can-i-auto-populate-email-field-when-user-f...

Try to tweak code you see in above threads as per your need.

Please hit like and mark my response as correct if that helps
Regards,
Musab

Ankur Bawiskar
Tera Patron
Tera Patron

@Gudu 

So basically on change of reference variable it should bring group and set in the read-only variable?

If yes then you can use Auto populate feature with no scripting

Auto-populate a variable based on a reference type variable (Utah) 

If my response helped please mark it correct and close the thread so that it benefits future readers.

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