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 03:30 AM
I was able to add Reference Qualifier to field in catalog form that atleast narrowed down assets assigned to User.
For ex: When I selected David Anderson in 'Employee to Offboard' field,
The assets shown in the reference list were only those assigned to David Anderson.
But I need this data to be populated on the form somehow. Not sure what field type I can use here.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2024 03:51 AM
Share it here once
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2024 04:57 AM
This is the reference qualifier being used:
javascript: 'assigned_to=' + current.variables.employee_to_offboard;
It works for field type Reference but not for List collector
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2024 05:03 AM
In ' variable attributes ' of list collector put ref_qual_elements=employee_to_offboard
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2024 06:07 AM
Hi Sonam,
Thanks, that was helpful.
Altough, can you please let me know if there's any way to hide filter conditions for List collector:
I don't want to show the filter conditions here or is there a way I can populate the values in Available Bucket List to Selected Bucked List