How to show change request variable editor on its change task

gowthamanbalu
Tera Contributor

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.

6 REPLIES 6

rakesh11734
Kilo Contributor

You can add the variables in the workflow variable task option. you can add variables what ever you want appear on the task form into right box. That variables will be appear on the task form.  


Thanks Rakesh. I have created a new HTML field in task form, By using a business rule I queried "question_answer" table and display the questions through that HTML field. It works for non reference variables.


TSP666
Kilo Contributor

I have the same issue, did anyone find a way to the the "variable editor" (online form from record producer) onto the change task.


I have the form on the change request but also need it on the change task.


I have configured change task to enable usage of the variable editor (ServiceNow KB: Determining whether the Variable Editor is added to a form (KB0538897) )


gowthamanbalu
Tera Contributor

Hi Tony,



Please refer the thread Newly created Variable Editor on Change Request and Change Task not showing. I have applied the below logic and it works well. But this can not be used for reference type variables.For reference variables, it will show the sys_id not the value.



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 != ''){


  todo += '<tr><td align = "left"><i><b>' + hrvar.question.getDisplayValue() + '</b></i></td><td>: </td><td>' + hrvar.u_custom_value + '</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_to_do = todoFinal;



Regards,


GB