Need help in auto populating assets assigned to user in catalog item
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2024 03:04 AM
Hi Community,
I want to auto populate the Assets that are assigned to user in Offboarding catalog form.
When the requestor select the user name who is being offboarded his assets must also be auto populated in other variable.
I tried via On Change client script but it seems I'm failing at some point.
The assets linked to user can be multiple, so I'm confused how do I write fields for it.
For ex: Below is the My Assets report that shows assets assigned in alm_asset table:
As you can see there can be multiple assets assigned to user. My requirement is to populate this data on the Offboarding form somehow.
The client script I tried:
var assetGR = new GlideRecord('alm_asset');
assetGR.addQuery('assign_to', userId);
assetGR.query();
// Clear existing values in asset fields
g_form.setValue('variables.asset', ' ');
// Loop through the assets and populate catalog item fields
while (assetGR.next()) {
g_form.setValue('variables.asset', assetGR.getValue('display_name'));
}
Please suggest me a way how can I bring this data on the catalog form.
Thanks in Advance,
Hritik
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2024 06:25 AM
add -> ;no_filter in variable attributes
Available Bucket List to Selected Bucked List - I saw this coming..
For this - https://servicenowguru.com/scripting/client-scripts-scripting/move-list-collector-options/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2024 06:35 AM
Hi Sonam,
with the existing reference qualifier the no_filter attribute isn't working. If I only added no_filter in varaible attribute then it works but not with exisitng
ref_qual_elements=employee_to_offboard;no_filter
I tried many combinations.
Could you suggest what is it that I'm doing wrong ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2024 06:44 AM
Please ignore previous mesg. I was using wrong syntax to concatenate attributes.
I used comma which is working