Map Reference Variable to RITM Reference Field

sarahyelton
Tera Expert

Good morning.   I have searched for and read similar questions but none have helped me thus far.   I have a workflow for a specific catalog item where they cite the application for the change.   (FYI . . . we are not pursuing the change record producer avenue at this time, we want to keep it as a RITM.)   This is a variable I setup as a lookup box referencing the cmdb_ci_appl table.   I modified the RITM form to include the cmdb_ci field from the task table.   In my workflow I would like to set the value since I cannot set this up as a record producer.   I am able to successfully set the value of the short description via the workflow, but it is not setting the value for the CI.   I have tried both of these and neither worked.   How can I accomplish this?

current.short_description = current.variables.CCRshortdescription // copy request short description to item   short description

current.cmdb_ci = current.variables.CCRchangeapp   // copy variable app to be changed to ci

AND

current.short_description = current.variables.CCRshortdescription // copy request short description to item   short description

task.cmdb_ci = current.variables.CCRchangeapp   // copy variable app to be changed to ci

Most of my scripting is a trial and error based on examples I find, so I am certainly not a developer.  

4 REPLIES 4

Deepak Kumar5
Kilo Sage

In your catalog Task activity, use below code in advance script.


task.cmdb_ci=current.variables.variable_name;


Hi Deepak.   Unfortunately, that is not working.   We do not have any tasks with this item.   I am using the Run Script function for the RITM workflow.   Does it matter that my lookup is using the cmdb_ci_cppl table (to limit to only application selection) and I am trying to map to the task table field cmdb_ci?


I have the same question - has anyone figured this out?


Then you can use the same code with your task object created. Table is not an issue as it is referring to base table cmdb_ci.



var NS= new GlideRecord("sc_task");


NS.initialize();


NS.u_short_description = current.variables.u_short_description;


NS.u_description = current.variables.u_description;


NS.insert();