Populating user assigned assets to user request in the Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2024 07:39 AM
I'm attempting to create an item in the catalog that will give users USB drive access on their laptops. I can get the user's assigned assets to populate in a list collector, but it's not giving me the CI name, it's only giving me the model of the laptop. The end result is once the usb drive access is approved, that laptop will then get added to an AD group to allow access to the USB drive.
I've got two variables, employee requesting exception (reference to sys_user) and computer name (alm_hardware). I can't get the computer name list collector to return the CI name instead of the model name so I can automate adding it to the AD group.
Any ideas?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2024 08:04 AM
Hi @RacheleTashjian,
A couple of clarification points to help you with the solution... As I'm sure you know (or if you didn't), the Asset table (alm_hardware) is a different table to the CI (appropriate CI table eg: cmdb_ci_computer) table therefore getting the CI name requires a few more steps.
Firstly, and importantly, I assume that all assets in your org/instance have a related CI. Please note this is not always the case, so please be mindful when writing code and testing and catering for this.
Based on the assumption that all Assets are related to a CI, you'll notice a field called 'Configuration Item' on the Asset table. This is the pointer and link to the appropriate CI that you're after.
It's important to note this field stores the sys_id - the unique ID of the specific CI. You want to use this sys_id rather than the name when thinking for the future automation as it is very common for CI's to share the same name.
For your initial question and presenting the CI name to the user, depending on what you've implemented and how you're performing the lookup (either client script or server side via script include) you can either 'dot-walk' to the CI name just by adding the following syntax:.ci.name
(Please let me know exactly how you're performing the query by obtaining the Asset name currently if we need to adjust it)
To help others (or for me to help you more directly), please mark this response correct by clicking on Accept as Solution and/or Kudos.
Thanks, Robbie
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2024 10:52 AM
What i did was create two variables on a catalog item. One variable is the employee who is requesting the exception and the computer name which should auto populate when the user name is chosen in the form. They should be able to see their laptop name, which i would then use in the workflow to add the computer to the AD group. I'm not doing business rules or client scripts. Right now the computer name variable is pulling from the alm_hardware table and is populating the user's assigned assets as their description instead of the CI name (every laptop has a CI name). If I use cmdb_ci_computer, I get the entirety of the CMDB and not what's assigned to the user.
The computer variable has some reference qualifiers stitched together from another item but doesn't exactly work as intended, just gives me the assigned assets of the user, not the CI name which is what i need.
The bolded text below is the questionable coding
ref qual - javascript:"u_asset_ownership!=employee_owned^ORu_asset_ownership=^assigned_to=" + current.variables.employee_requesting_exception
variable attributes - no_filter = true, ref_qual_elements=employee_requesting_exception (this is the employee variable)
If i need to create a business rule or something similar, I'd love the steps to do that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2024 11:23 AM
Hi @RacheleTashjian,
Thanks for clarifying. We can absolutely achieve what you need here.
However the key question is (based on the high level question and requirement) when the access is approved and the "laptop" needs to be added to an AD group to allow access to the USB drive - we are referring to the CI laptop record (Name and unique ID - right. Not the Asset laptop record)
If your form is generally displaying all the information as you/the user requires yet you want to pass the correct information via the workflow behind the scenes, simply add a step in your workflow to lookup the CI sys_id and name based off of the current Asset sys_id.
You'll notice I refer to the CI sys_id and name again as it is pretty common to see numerous CI's with the same name - especially for laptops (If you think about it, if your organization uses Dell laptops or Apple laptops for example, their name such as Macbook Pro 15 would be the same for every user that has one, which is why the sys_id and unique identifier such as serial number or even the Asset Tag is important here.
I would confirm what is the unique identifier that the team who grant the access via AD/automation is and use that - you may find that it is the Asset tag and you may not need the CI name.
If you confirm that unique identifier, I'll provide a sample script for you.
To help others (or for me to help you more directly), please mark this response correct by clicking on Accept as Solution and/or Kudos.
Thanks, Robbie
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2024 09:28 AM
I'm going to attempt this at some point this week either later today or tomorrow. I'll keep you posted.
Thanks again for your prompt responses.