Populate Device List Based on Requested For User in Catalog Item

tilekarnilesh
Giga Guru

Hi Community,

I’m working on a Service Catalog item where I want to dynamically populate the list of devices based on the user selected in the  field.

Here’s the requirement:

There is a variable named please_select_the_device_name_hostname in the catalog item.

When a user is selected in the requested_for field, this variable should display only the devices (from the cmdb_ci_computer table) where the assigned_to field matches the selected user.

The goal is to allow the user/requester to choose from devices that are already assigned to the selected user.

Has anyone implemented this before? What’s the best way to write the Reference Qualifier for this use case?

Thanks in advance!

3 ACCEPTED SOLUTIONS

Ankur Bawiskar
Tera Patron
Tera Patron

@tilekarnilesh 

that variable for devices is reference type.

You can use advanced ref qualifier for the variable

javascript: 'assigned_to=' + current.variables.requested_for;

If that is list collector type then use this

javascript: 'assigned_to=' + current.variables.requested_for;

also use this in the variable attributes

ref_qual_elements=requested_for

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

View solution in original post

@tilekarnilesh 

we can't see the image, there is some issue going in community and we are unable to see the images.

Please add the file using browse feature.

share all the screenshots.

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

View solution in original post

@tilekarnilesh 

variable attributes not required for reference type variable, remove that

Also is the variable name correct requested_for ?

Also use this : and not :

It's a bug in community and it converts colon to the other value.

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

View solution in original post

6 REPLIES 6

Ankur Bawiskar
Tera Patron
Tera Patron

@tilekarnilesh 

that variable for devices is reference type.

You can use advanced ref qualifier for the variable

javascript: 'assigned_to=' + current.variables.requested_for;

If that is list collector type then use this

javascript: 'assigned_to=' + current.variables.requested_for;

also use this in the variable attributes

ref_qual_elements=requested_for

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

@Ankur Bawiskar variable type is reference 

I tried, but it's not working, it's showing all devices.

tilekarnilesh_0-1753877732006.png

 

@tilekarnilesh 

we can't see the image, there is some issue going in community and we are unable to see the images.

Please add the file using browse feature.

share all the screenshots.

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

@Ankur Bawiskar  
variable type is reference 

I tried, but it's not working, it's showing all devices.