How to get reference value from a reference variable?

tee3
Giga Expert

var ci = current.variables.cmdb_ci.getDisplayValue();

gs.log('CI' + ci);

if(ci)

{

var techSupport = ci.support_group;

gs.log('This is the support group' + techSupport);

task.assignment_group = techSupport;

}

else {

task.assignment_group = '9d7cbca24fb271007a990f5e9310c7e9';

}

I'm missing something fairly easy here, in the above code, my variable "techSupport" is always undefined. I'm using this script in the workflow activity to assign the task to a group based on the ci's support group(field named support_group on the ci form) if a ci is selected or assign to a defined group if its empty. The second part works. I cannot seem to get the value of the support group field for the ci on the item. I've tried getDisplayValue() with no luck.

Appreciate your help!

1 ACCEPTED SOLUTION

SanjivMeher
Kilo Patron
Kilo Patron

Try this




  1. if(current.variables.cmdb_ci)  
  2. {  
  3. gs.log('This is the support group' + current.variables.cmdb_ci.support_group);  
  4. task.assignment_group = current.variables.cmdb_ci.support_group;  
  5. }  
  6. else {  
  7. task.assignment_group = '9d7cbca24fb271007a990f5e9310c7e9';  
  8. }  

Please mark this response as correct or helpful if it assisted you with your question.

View solution in original post

5 REPLIES 5

Ok, thanks guys!