How to filter results in Look up Variable

Brian Sorensen
Giga Guru

We are redoing one of our Service Catalog items for Cell phone upgrade requests, right now when the user opens the form we prepopulate the Users name, but then ask them to fill in the information for 

Current Phone
Phone Number

Serial Number

 

These are all pieces of informations stored in the Peripheral table, so we want to prepopulate it for them

Right now I have it set like this (just testing to get 1, then the rest should work..)

Variable 1 Reference to sys_user table - User (user)
Variable 2 Lookup Select Box - looking up the cmdb_ci_peripheral

I have this set to only show devices assigned to the user with the following

javascript: 'assigned_to='+current.variables.user

 

This works, but shows ALL peripherals. I want to limit the box to show JUST the Mobile devices, which is Type - Mobile Device.  If I look this up in the peripheral table, Mobile Device shows as sequence 5

 

What do I need to change on the javascript to filter down to the mobile only or is there a better way?

 

I tried

javascript: 'assigned_to='+current.variables.user+'^type'=5 or mobile_device and neither worked.

 

Once I have that, I should be able to script in the retrieval of the serial number, phone number etc

 

BrianSorensen_0-1718201812633.png

 

1 ACCEPTED SOLUTION

Sandeep Rajput
Tera Patron
Tera Patron

@Brian Sorensen Please update your reference qualifier as follows.

javascript:'assigned_to='+current.variables.user+'^type=mobile device';

Screenshot 2024-06-12 at 8.07.30 PM.png

The difference: In your reference qualifier you are using quotes ('') incorrectly to filter type in your qualifier.

 

Also, if your Mobile Devices internal value contains _ e.g. mobile_device then the qualifier would get updated as follows.

javascript:'assigned_to='+current.variables.user+'^type=mobile_device';

Hope this helps.

View solution in original post

3 REPLIES 3

SAI VENKATESH
Tera Sage
Tera Sage

Hi @Brian Sorensen 

 

The better way is that you can write a script include and call the script include in the reference Qualifer.

 

Thanks and Regards

Sai Venkatesh

Sandeep Rajput
Tera Patron
Tera Patron

@Brian Sorensen Please update your reference qualifier as follows.

javascript:'assigned_to='+current.variables.user+'^type=mobile device';

Screenshot 2024-06-12 at 8.07.30 PM.png

The difference: In your reference qualifier you are using quotes ('') incorrectly to filter type in your qualifier.

 

Also, if your Mobile Devices internal value contains _ e.g. mobile_device then the qualifier would get updated as follows.

javascript:'assigned_to='+current.variables.user+'^type=mobile_device';

Hope this helps.

Thank you!! really appreciate it.  I had a feeling it had the quote in the wrong spot and was losing my mind