Auto populate the current users laptop in a catalog item

Moedeb
Tera Guru

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

1 ACCEPTED SOLUTION

@Moedeb 

 

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.


Please mark this response as correct and helpful if it assisted you with your question.

View solution in original post

24 REPLIES 24

Juhi Poddar
Kilo Patron

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:

JuhiPoddar_0-1728958427119.png

"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

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.

@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.

Moedeb_0-1728962042404.png

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.

 

Hello,

 

I see you have added ';' instead of ":" 

 

Please replace and try once more