- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-26-2015 02:32 PM
I have create a record producer for change_request.
In this I am also creating change task for this change request.
So here I want to display all the variables in the record producer in change task description field like " <variable name1 >: <variable Value1>, <variable name2>: <variable Value3>}"
I tried some script by querying from "question_answer" table to get the variable details but It is not giving the variables.
Is there any way to loop all the variables.
Thanks In advance..
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-27-2015 04:50 PM
try this:
var gr = new GlideRecord('question_answer');
gr.addQuery('table_sys_id', '1116a6870f0a020062b6e64be1050ec6'); //sys_id of record in question
gr.query();
while (gr.next()) {
if (gr.value) { //exclude questions with empty values
gs.print(gr.question.getDisplayValue() + ": " + gr.value); //display question and answer
}
}
should return something like:
*** Script: Please describe your issue below: user entered description
*** Script: Open on behalf of this user: 7839639120196100636f41ee6e8383d6
*** Script: Short description (Subject Line): user entered short description
will take a bit more work if you have referenced values.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-26-2015 02:58 PM
Try something like this:
current.description = producer.variable1 + ' , ' + producer.variable2 + ' , ' +producer.variable3, etc
if one of the variables is Reference type, use producer.variable.getDisplayValue()
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-27-2015 09:30 AM
Thanks Michael for your reply..
If I use "producer.variable1" will get only variable value, But I need variable name (i.e Question) also.
I want to concatenate the question and answer like " {<Question1 > : < Value1> , <Question2>: <Value>......}"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-27-2015 11:08 AM
I think that is the correct approach.
Can you share your script that you have prepared for reading the questions from question_answer table?, What is the trigger point for that script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-27-2015 11:14 AM
Hi Srinivas,
I have tried the below script.
ql.addQuery('table_sys_id', current.sysapproval.toString());
ql.orderBy('order');
ql.query();
var tempVar='';
gs.log('current.sysapproval.toString()::::'+current.sysapproval.toString());.
but I am getting "current.sysapproval.toString()" is undefined..
I wrote this script in Record producer script