Catalog Item Set Value on Incident

Dallas Fanchier
Tera Expert

I currently am working on a catalog item.  I have a variable that uses a list collector for the computer table.  On the form you can select multiple computers by name.  In my workflow I create an incident and set the description to list the list collector results.  It returns the sysid and not the computer name.  I checked dictionary to make sure I wasn't crazy and the name field is set to name.  I was looking at functions on the variable in the flow designer but not sure how I can fix this.  When I had it set to reference where only one record can be selected it worked properly but when I changed it to multi select I started having this issue.

1 ACCEPTED SOLUTION

Hi @Dallas Fanchier 

 

Give this a try

var comp = fd_data._1__get_catalog_variables.server.toString();
var str = '';

if (comp != '') {

var compList = comp.split(',');



for (i = 0; i < compList.length; i++) {


var grComp = new GlideRecord('cmdb_ci_computer');

grComp.addQuery('sys_id', compList[i]);

grComp.query();


while (grComp.next()) {

str += grComp.name + ', ';

}}}
return str;

 

 

View solution in original post

10 REPLIES 10

@Dallas Fanchier 

 

What is the trigger for your flow designer and on which table is the server field created

Can you share flow designer snaps, that would help in getting the first line right in script

The trigger is a catalog item.  

 

DallasFanchier_0-1686074205286.pngDallasFanchier_1-1686074218461.pngDallasFanchier_2-1686074245282.pngDallasFanchier_3-1686074319613.png

 

@Dallas Fanchier 

 

Try with below script and see if it works

var comp = fd_data.trigger.variables.server.toString();
var str = '';

if (comp != '') {

var compList = comp.split(',');



for (i = 0; i < compList.length; i++) {


var grComp = new GlideRecord('cmdb_ci_computer');

grComp.addQuery('sys_id', compList[i]);

grComp.query();


while (grComp.next()) {

str += grComp.name + ', ';

}}}
return str;

I get the following when attempting to activate.

DallasFanchier_0-1686074809597.png

 

Hi @Dallas Fanchier 

 

Give this a try

var comp = fd_data._1__get_catalog_variables.server.toString();
var str = '';

if (comp != '') {

var compList = comp.split(',');



for (i = 0; i < compList.length; i++) {


var grComp = new GlideRecord('cmdb_ci_computer');

grComp.addQuery('sys_id', compList[i]);

grComp.query();


while (grComp.next()) {

str += grComp.name + ', ';

}}}
return str;