Copy functionality for RITM on portal

BabaS6658192191
Tera Contributor

I have a requirement on portal, where we need to copy the RITM for a specific catalog item's RITM. And when they click on the RITM it should open the new catalog item to auto populate the variable values from the original RITM.

 

I have updated the widget to show the copy button and then it will redirect to empty catalog item, but not able to find a solution to auto populate the variable values from the original RITM to the new catalog form opened. 

 

I want this to open in a new catalog form, so the users can edit and submit the accordingly to create request from portal.

 

 

1 ACCEPTED SOLUTION

Anvin
Tera Expert

Hello,

 

If you have to redirect to the item page, you have to construct an URL,

 

1. encode the RITM sys_id in the URL and in the catalog item

2. have an onLoad client script to get the parameter from URL.

3. the parameter will hold the old RITM sys_id, query the RITM and get the values using GlideAjax.

4. Construct a JSON from server side and pass it to client and set the values in the fields.

View solution in original post

6 REPLIES 6

Anvin
Tera Expert

Hello,

 

If you have to redirect to the item page, you have to construct an URL,

 

1. encode the RITM sys_id in the URL and in the catalog item

2. have an onLoad client script to get the parameter from URL.

3. the parameter will hold the old RITM sys_id, query the RITM and get the values using GlideAjax.

4. Construct a JSON from server side and pass it to client and set the values in the fields.

Hi Anvin, If you have already implemented that solution can you give me the script for the same. Im fairly new to portal scripting and it will help me.

The following article is explaining the URL extraction very well. please check this out,

 

https://www.servicenow.com/community/service-management-articles/extracting-url-parameters-in-servic...

 

If this solves the issue, please mark it as solved.

Can you help me how this can be used in my solution little more detail please. all this is little too generic for me