How to copy data into the TASK from the RITM

stevenhumpherso
Giga Contributor

Good day, ever helpful community...

I have a situation where my production instance of ServiceNow 'somehow' copies the inputs from the Service Catalog input (RITM) into the task.   However it does not do this on my Dev instance.   Could you wonderful people please advise on how I can find out 'HOW' this has been done.   So that I can mirror both systems.   I did not build the original service Catalog in production.   I am therefore building\testing the updated Service Catlog for IT & a brand new SC for our facilities team.

I'm currently in testing for the new catalog (for Facilities) & I've noticed that for both the standard IT service catalog (which I have built)   & the newly created facilities Service catlog (which ive also built) this is not available.   please see example screenshots.

Production (not built by me)

find_real_file.png

Dev (built by me)

find_real_file.png

I'm aware that this 'may' turn into a long list of places to check.   I'm also aware that when I transfer the update sets from dev to prod this may also 'just work'... however.   I don't want to take any chances & would love any help to get to the bottom of this.   plus surely dev should match prod.  

Once found.   I will also happily post 'how' this was done.   As I've noticed & found a number of posts asking how to do this.

Thanks in advance.

1 ACCEPTED SOLUTION

Check the Catalog Task activity and look for a statement in the script section that copies the item variable to the task work notes.   Something like:


task.work_notes = current.variables['your_variable_name'];



Also, do you know that you don't have to copy the variable contents to the task if you are only trying to make them visible to your techs?   You can show the variable on the task just by using the Add variables section of the workflow, then adding the variable editor to the task form.


View solution in original post

14 REPLIES 14

I'll give it a go... So at least I've got a 'plan b' if & when the update sets are moved over & it doesn't work.   However im trying to find 'how' this was done in prod.   so I can then recreate on dev.   As I mentioned I wasn't involved in the original build & this is my first setup of SN.   so im a bit of a noob.  


Sadly this is missing information I need to create the business rule.   ive posted on that link to check.  


Hey Steve,



For the business rule, create it on the Catalog Task (sc_task) table, the business rule should run only during insert. Add the below conditions to it.



1. Parent is Not Empty


2. Parent.Table Name is Requested Item (sc_req_item)



Now in your script you can write something like this.



(function executeRule(current, previous /*null when async*/) {




// Add your code here


var gr = new GlideRecord('sc_req_item');


gr.addQuery('sys_id',current.parent);


gr.query();


var desc = '';


if(gr.next())


{


for (var key in gr.variables) {    


var v = gr.variables[key];    


desc += '\n' + v.getGlideObject().getQuestion().getLabel() + ": " + v.getDisplayValue();


}


}


current.description = desc;




})(current, previous);



Also you can definitely check what Karla has mentioned


I think this could become my permanent solution... Thank you.  


kchorny
Tera Guru

The copying of the variable to the task may be happening in the workflow.   Have you checked there?