Set Configuration item in the Open IT Ticket Topic to user's assigned to asset.

bekfro
Kilo Sage

I'm looking for the best way to set the Configuration item in the Open IT Ticket 2.0 topic to the logged-in user's computer asset.  I would like to use the alm_asset table and search for the assigned_to = vaInputs.user

bekfro_0-1699392829698.png

 

bekfro_1-1699392936553.png

 

 

1 ACCEPTED SOLUTION

Sandeep Rajput
Tera Patron
Tera Patron

@bekfro Use the following script.

(function execute() {

var ci_item='';

var glideRecord = new GlideRecord('alm_asset');
glideRecord.addQuery('assigned_to',vaInputs.user);
glideRecord.query();
if(glideRecord.next()){
ci_item = glideRecord.getValue('ci');
}
return ci_item;

})()

Hope this helps.

View solution in original post

2 REPLIES 2

Sandeep Rajput
Tera Patron
Tera Patron

@bekfro Use the following script.

(function execute() {

var ci_item='';

var glideRecord = new GlideRecord('alm_asset');
glideRecord.addQuery('assigned_to',vaInputs.user);
glideRecord.query();
if(glideRecord.next()){
ci_item = glideRecord.getValue('ci');
}
return ci_item;

})()

Hope this helps.

bekfro
Kilo Sage

@Sandeep Rajput 
Thank you!  I was able to add an else statement to set a CI if the Computer is not assigned to the user. 

 

Working great!