- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-14-2024 06:53 PM
I have a reference field on alm_asset and I just want to show in that field (on load) the current users assigned laptop.
So for us laptops all have a model category of 'Computer', so I'd tried to set the default value of the field as follows:
Variable name: vs_laptop_asset_number
Table: alm_asset
Asset model category 'Computer' sys_id: 81feb9c137101000deeabfc8bcbe5dc4
Asset assigned user field name: owned_by
Default value:
javascript:model_category=81feb9c137101000deeabfc8bcbe5dc4^owned_by=gs.getUserID();
This obviously has not worked as I'm asking all of you for some help please
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-14-2024 10:28 PM
In that case, you can may be populate the asset owned as per the asset table in one variable which could be read only and have a confirmation checkbox stating "Does the above listed asset does not belongs to you ?". If the user response is yes, you can have a variable for them to select the asset.
Let me know your thoughts on this and we can further work it towards closure.
Amit Verma
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-14-2024 07:14 PM
Hello @Moedeb
To achieve this in your reference field, you can use a reference qualifier script to filter the results based on the asset's model category and the current user. Here's how you can adjust it:
Reference Qualifier: Instead of using a default value, apply a reference qualifier directly in the field's settings to filter the assets dynamically.
Here's a script that should work in the reference qualifier of the field:
javascript: 'model_category=81feb9c137101000deeabfc8bcbe5dc4^owned_by=' + gs.getUserID();Refer the below image to set advanced Reference qualifier for a variable:
"If you found my answer helpful, please give it a like and mark it as the accepted solution. It helps others find the solution more easily and supports the community!"
Thank You
Juhi Poddar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-14-2024 07:28 PM
Thank you @Juhi Poddar unfortunately I need users to be able to reselect if for some reason the asset is incorrect to what they actually have.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-14-2024 08:15 PM
@Juhi Poddar I also tested your option to see if maybe it still did what I needed, however it did not work for me at all.
When testing it on a catalog item, the reference field just remains blank and all assets are available to select from.
I can also confirm that I am the logged in user and have a device assigned to me.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-14-2024 08:37 PM
Hello,
I see you have added ';' instead of ":"
Please replace and try once more
