Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Copy variables from Catalog Item into Request form fields?

mitzaka
Mega Guru

Hi SNC,

 

I use a catalog item which has a couple of variables for Short Description/Description. I managed to get them copied into the RITM, but I need a way to copy them into the Request (REQ) which is initially created after submission, because the first notification is actually based off the sc_request table and I need to provide users with the variable content in this first notification.

 

What's the easiest way to do this?

Thanks!

1 ACCEPTED SOLUTION

In my case where I wanted the Short Description field copied from variable into form, the final solution was an AFTER business rule on Requested Item table with the following script:



var request =current.request.getRefRecord();


request.short_description = current.variables.short_description;



Note: the name of my variable is short_description as well.


So that worked perfectly.


View solution in original post

22 REPLIES 22

OK, I think I got it - you were 90% correct Kalaiarasan P


Only thing which I removed form the business rule script (and Yes, it was an AFTER) was the request.update();


I think this should not be used, because it is causing a duplicate record creation.


However, it worked just fine, so thank you for the proposal:)


so what was the final solution?


In my case where I wanted the Short Description field copied from variable into form, the final solution was an AFTER business rule on Requested Item table with the following script:



var request =current.request.getRefRecord();


request.short_description = current.variables.short_description;



Note: the name of my variable is short_description as well.


So that worked perfectly.


you may close of the loop as you have answered your own question  


HI Kalai ,



I have a case where I need to copy one of the field value from catalog item table (sc_cat_item) to   request table (sc_request) on submission of an catalog item. Like how the price value is been passed. In my case I have created a new field in the Catalog item view and also a slimier field created in the request table. Now I need to pass that field values. Will you please able to help me?



Regards


Bibeesh