How to show change request variable editor on its change task
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-31-2016 10:50 AM
Hello,
I can able to display the catalog variables using variable editor in change request. But I can not display the same to its child record(change task). How to show the change request catalog variables to change task form.
Thanks,
Gowthaman.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2018 06:30 AM
Hi Gowthaman,
try this code out :
(function executeRule(current, previous /*null when async*/) {
var todo = '';
var hrvar = new GlideRecord('question_answer');
hrvar.addQuery('table_sys_id', current.sys_id);
hrvar.setLimit(50); //just for security
hrvar.orderBy('order');
hrvar.query();
while (hrvar.next()){
if (hrvar.question.type != 11 && hrvar.value != '' && hrvar.question.type != 8 ){
todo += '<tr><td align = "left"><i><b>' + hrvar.question.getDisplayValue() + '</b></i></td><td>: </td><td>' + hrvar.value + '</td></tr>';
}
// 8 is for reference value ....
if (hrvar.question.type == 8){
var qq = new GlideRecord(hrvar.question.reference.getDisplayValue());
qq.get(hrvar.value);
var a = qq.getDisplayValue();
gs.addInfoMessage("Test the value a: "+a);
todo += '<tr><td align = "left"><i><b>' + hrvar.question.getDisplayValue() + '</b></i></td><td>: </td><td>' + a + '</td></tr>';
}
if (hrvar.question.type == 11){
todo += '<tr bgcolor = "#f6f6f6"><td colspan = "3" align ="left"><b></b></td></tr><tr bgcolor = "#f6f6f6"><td colspan = "3" align ="left"><b>' + hrvar.question.getDisplayValue() + '</b></td></tr>';
}
}
var todoFinal = '<table>' + todo + '</table>';
current.u_todo = todoFinal;
})(current, previous);
P.S: Please ignore my naming conventions ..... The question.type reference value is 8 and I wrote special if for that and this gets the value.Let me know if you need any more help on this. I can show you the demo which I have created.
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-23-2018 10:00 AM
I have added the Change Variable Editor to my change_request form, but what method will populate the Change Variable Editor field?
Today I use a business rule that looks up the variables from sc_req_item and just places into the Description field of the change, but using the variable editor field would be a lot neater.
