How to pass List collector multiple values from SNOW to JIRA

Koyel Guha
Tera Contributor

Hi,

Need help to pass multiple values from SNOW to JIRA. We are using record producer and we have list collector variable with the choices defined in the question_choice table. In the flow designer, I have done a look up in the question_choice table with condition "sys id is one of getcatalogvariable.variable_name" and also tried with a flow variable by taking For Each question choice value. Also tried with a script 

 

var arr = fd_data._1__get_catalog_variables.variable_name;
var member=  JSON.stringify(arr);
return member.slice(1,-1);
 
But nothing is working. Either its taking an output with combining the two values in single word or its taking sys id. 

 

I am getting this type of error : 

{
    "Action Status": {
        "code": 1,
        "message": "Error:  Option value ' Turbo' is not valid (Process Automation.3c5dd02e77f11110cc985228c81061d5; line 4)"
    }
}

 

Can somebody please help me to achieve this requirement ? 

 

Thanks in advance.

 

 

 

 

 

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@Koyel Guha 

how does JIRA expect the value?

use this to get display value

var users = '' + fd_data._1__get_catalog_variables.variable_name.getDisplayValue(); // convert to string
 
return users.toString();

OR

If the above doesn't work then use this

var users = '' + fd_data._1__get_catalog_variables.variable_name.toString();

var arr = [];
var gr = new GlideRecord("question_choice");
gr.addQuery("sys_id", "IN" , users);
gr.query();
while (gr.next()) {
   arr.push(gr.getValue('text'));
}
return arr.toString();

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

5 REPLIES 5

Najmuddin Mohd
Mega Sage

Hello @Koyel Guha ,

Can you try the below script.

 

var users = '' + fd_data._1__get_catalog_variables.variable_name; // convert to string
 
var list = users.split(',');  // Convert the comma-separated string to an array

return list;
 

 
If the above information helps you, Kindly mark it as Helpful and Accept the solution.

Regards,
Najmuddin.

Hi Najmuddin,

Thank you for your response.

I have tried what you have advised. However, I am getting sys ids 

["c5d1a665ebeb56109ba3f4de0bd0cd30","9102e2a5ebeb56109ba3f4de0bd0cd92"]

 and it is giving an error : Error: Option value '"9102e2a5ebeb56109ba3f4de0bd0cd92"]' is not valid (Process Automation.5e66797e9f9c02105760e6073b0a1c1c; line 3)

 

can you please help.

 

Hello @Koyel Guha ,
What exactly the Output you need ?

Can you try with Postman with multiple users to JIRA and check?

If it's accepting multiple users, then what it need to be get?
The user names ?

Since, you are getting sys_id, you can glideRecord the 'sys_user' table in the script and return gr.getDisplayValue(), or gr.name or anything...


If the above information helps you, Kindly mark it as Helpful and Accept the solution.
Regards,
Najmuddin.

Ankur Bawiskar
Tera Patron
Tera Patron

@Koyel Guha 

how does JIRA expect the value?

use this to get display value

var users = '' + fd_data._1__get_catalog_variables.variable_name.getDisplayValue(); // convert to string
 
return users.toString();

OR

If the above doesn't work then use this

var users = '' + fd_data._1__get_catalog_variables.variable_name.toString();

var arr = [];
var gr = new GlideRecord("question_choice");
gr.addQuery("sys_id", "IN" , users);
gr.query();
while (gr.next()) {
   arr.push(gr.getValue('text'));
}
return arr.toString();

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader