Narsing1
Mega Sage

About this Article

This Article helps you to address the issues with OOTB feature to "Create Request" from an Incident.   I implemented in a different way by keeping in mind of practical issues that occurs in regular Developer life.  The Issues that I found are:

  • The Resolver needs to select the Catalog Item from Resolver view and not from the Portal
  • Most of the functionalities i.e. UI Policies, Client Scripts like Onchange/Onload etc., that works properly in Portal and will not work in Platform/Resolver View because most of the times the Developer will always concentrate how it is behaving on Portal keeping in mind of his/her deliverables.
  • The Resolver needs to fill the Catalog Form from Platform manually all the values such as Requestor Information etc.,
  • If the Catalog Item has Multirow Variable Set, then it might work differently in Platform and Portal.

Since it is difficult to manage a Catalog Item form from both Platform and Portal, this article explains a way on how you can handle and overcome this issue and provide a one point place for all your catalog Item to point only to Portal while converting an Incident.

 

Approach

Resolvers will have a UI Action Button on Incident form for all Open Tickets like this

find_real_file.png

 

Once the Resolver decides to convert this Incident as a Request, he then needs to click on "Convert To a Request" Button. He will be able to see a popup like this. 

Now, he needs to select the Catalog Item that he wanted to convert it into and click on "Create Request"

 

find_real_file.png

The Resolver will be redirected to the portal link of selected Catalog Item once he click on "Create Request" with all the Incident Information as below.

find_real_file.png

find_real_file.png

Now, the Resolver is able to see all the related information that is being populated over here in the Catalog Item.  He then can fill the remaining information if any and submit the request.

Thus, The process of being converting an Incident to a Request is shifted from Platform to Portal which is a good practice.

 

Once the Request is being submitted, the Incident will be automatically cancelled with a proper comments as below

find_real_file.png

find_real_file.png

find_real_file.png

 

Backend 

In the background, we will have a field mapping Table as below to map Incident field to Catalog Item form field like this

find_real_file.png

find_real_file.png

 

Download the update set from Share and provide your feedback to improve this utility.

 

Download Link

 

Please bookmark/mark it as helpful if it helps you.

 

 

 

Comments
prashantamaiy1
Tera Explorer

Hi,

 

Its very helpful, when I try to import this update set and used it. Variables are not getting values on the SP.

I have did the mapping as well, is there anything I missed out.

 

Please do let me know so that I can complete this.

 

Regards,

Prashant Amaiy

Narsing1
Mega Sage

Hi Prasanth,

have you included "Standard - Incident to Request Conversion" Variable Set into your Catalog Item.If not, please add.

Here are the general steps that you need to make sure while using this Utility.

Steps

1. Commit the Update

2. Go to a Catalog Item and check "Enable for Incident Conversion" that is available in "Portal Settings" Tab.

3. Add a variable set called "Standard - Incident to Request Conversion" to this Catalog Item.

4. Go to "u_incident_catalog_mappings.LIST" TABLE and start adding the entries like this. Example

    Entry#1 Catalog Item = <your catalog item> Catalog Variable Name = <your catalog variable> In order to map caller_id, this variable must be a reference pointed to sys_user. Incident Field = <incident field ex: caller_id> Sequence = 1

   Entry#2 Catalog Item = <Your catalog Item> Catalog Variable Name = short_description Incident Field = short_description Sequence = 2

5. Now, go to any Open Incident and click on "Convert to a Request" UI Action Button and provide the Catalog ITem name as "<Your Catalog Item>" and click on "Create Request"

6. It opens the SP Portal and populates the information.

 

In case, if not working after the above steps, if possible, provide the instance details and I will fix it.

Thanks,

Narsing

Kelly Logan
Kilo Sage

Just be sure the Catalog Items you set up for this generate an RITM, or the Business Rule won't fire and the parent Incident will not be cancelled.

To reduce the risk of this, I modified the UI Page catalog_item_list_v2, line 31, to add a check for sys_class_name to the query: 

query="active=true^sys_class_name=sc_cat_item"

 

 

Narsing1
Mega Sage

Hey,

Thank you for your feedback.  I think this makes sense to add.  Would be better to add one more field as well, as I have created a field called "Enable for Incident Conversion" in sc_cat_item which will show only specific catalog items.  But it completely depends on your requirement.

query="active=true^u_enable_for_incident_conversion=true^sys_class_name=sc_cat_item"

find_real_file.png

Thanks,

Narsing

FNow1
Tera Contributor

I think he might be having the same problem I have. The sirc incident field isn't getting populated correctly. What happens is when the page is loaded the value is there but it then disappears. 

This doesn't allow you to build the relationship needed when submitting the item, for the business rules to execute. I enabled the view of the variable set to confirm this. find_real_file.png

Narsing1
Mega Sage

Oh.. got it.. Let me check this.. It will populate, but will check.  Thanks for your feedback.

Thanks,

Narsing

Narsing1
Mega Sage

Hi,

Can you check this widget client controller, it is setting the sirc value in 3 places.  Please use few alert statements whether it is setting the value properly/not.

I am getting the incident value properly.  In case, if you are not getting it, can you provide any error log statements that is available in the portal console (Chrome -> Right click -> Inspect -> Errors

Make sure to add the variable set called "Standard - Incident to Request Conversion" in your catalog item where you want to apply this conversion?

find_real_file.png

find_real_file.png

find_real_file.png

joymorales
Giga Guru

Narsing, thank you for sharing this knowledge and resources. Greatly appreciated.

I got everything to work using your Update Set and information, but I need your help with the following:

We have ServiceNow setup to automatically create Incident tickets from received emails.  By the time we open the ticket, the user's request description is in the Activities read-only section.  I looked, but cannot find how I can map that section field to the field that I have on the catalog items.  Is there a way to get the read-only information from the Activities section to a RITM field?

Thank you again!

Narsing1
Mega Sage

Hi @joymorales ,

Thank you for your feedback.  At present, the Activities can't be supported,  but I will come up a new version that covers your requirement.  In the meanwhile, you can proceed with the below configuration.

What all you need is a way to copy the information from Activities to the Description field.

#1 - Write a BR after Insert / update when the Description goes blank.

find_real_file.png

#2 - Inside the BR use this code to retrieve the activities information and post to Description.

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

    var j = new GlideSPScriptable().getStream("incident", current.sys_id.toString());
    var desc = "";
    for (var m = 0; m < j.entries.length; m++) {
        if (j.entries[m].value.toString() != "") {
            if (desc == "") {
                desc = j.entries[m].value.toString();
            } else {
				desc += "\n" + j.entries[m].value.toString();
			}
        }
    }
	if(desc != "") {
		current.description = desc;
	}

})(current, previous);

#3 - Once you done the above, remaining things are the same i.e. you can map the description field

Note:  In case, the Description is not updating, then use the condition like this 

find_real_file.png

 

Thanks,

Narsing

marcbowen
Tera Contributor

@Narsing Thank you very much for this, it works wonders and has been a big hit!

I have 2 questions:

  1. Is there a way to change the color of the Create vs Close?  Red usually mean stop and my end users click on Close when meaning to click on Create?
  2. Is there a way to set the Incident to the Parent field on the created request so that the request can be linked to the incident?

 

Narsing1
Mega Sage

Hey,

Thank you for your feedback. Here you go.

1. I believe you are asking for the UI Action Style. If so, There are 3 colors mainly in UI Action i.e. the Field called "Form Style" with Primary/Destructive/Unstyled.  Normally, when you use Destructive, it represents Thick Red (color is dependent on the Theme that they choose also, but users can easily identify it is something to be cautious when they click). Primary deals with Blue color

2. Attaching Incident to the Parent of RITM is a valid requirement and make sense.  I will try to come up with that in my next version.  

Thanks,

Narsing

manish kale
Tera Guru

manishkale_0-1665639692925.png

Hello,
I have implemented the same functionality using the same provided update set, the issue is when the incidents are viewed in the agent workspace and clicked on convert to a request. The list of catalog items is not visible when looking in look up list 'Search Catalog Item'. 
If anyone has a solution to this please reply. Thank You in Advance!!

Narsing1
Mega Sage

Hi,

On the Catalog Item, you will have this option.  Please use that.

Narsing1_0-1665679647663.png

Thanks,

Narsing

 

Sam Jeon
Tera Contributor

@Narsing1 

I have committed the Version 4 update set and followed all the steps that you provided. But when I click on the "Convert to Request" button on the incident, I am able to select the Catalog Item and create the Request, but the parent field of the new RITM is blank and the original incident stays in Open state and there is nothing in the activity that shows that the incident has been closed and converted to a RITM.

 

The only thing I changed was in the "catalog_item_list_v2" UI Page, I changed the "sp" to "esc" since we are using employee center.

Narsing1
Mega Sage

Hi @Sam Jeon 

Have you added the common variable set called "Standard - Incident to Request Conversion" into your catalog item and checked "Enable for Incident Conversion" as shown below. If not, please do and try again.

 

Narsing1_0-1666155921359.png

Also, I hope you have already provided the mappings via "Incident Catalog Mappings" Module.

Narsing1_1-1666156129973.png

Thanks,

Narsing

 

 

Sam Jeon
Tera Contributor

@Narsing1 

Thanks for your reply. But yes I have done all of those things that you mentioned. See my screenshots below:

1.png

 

 

 

2.png

 

joymorales
Giga Guru

Hello Narsing1.

 

Thank you for your continued help on this INC to REQ conversion solution.  Greatly appreciated.

Quick question:  Is there a way to make this tool select from available Order Guides too?  We have an Onboarding order guide that I would like to use to convert INC tickets for new hires to REQ/RITMs.  Would this be possible?

 

I created mappings like I did for catalog items and the "Enable for Incident Conversion" box has been checked on all the order guide related catalog items, but the order guide does not show up on the list after I click the Convert button on the INC form.

 

Any suggestions will be greatly appreciated.

 

Thanks again.

 

UPDATE: I opened the Order Guide configuration record itself and added the "Enable for Incident Conversion" box to it under the Portal Settings and  checked it.  I opened an INC, clicked the Convert button and now the Order Guide displays on the Catalog Items list.  I selected it and the order guide form displayed, but only the description portion of it.  The variable set that I have on the order guide did not display nor the Choose options tab, etc.  To make sure that the order guide had not been broken by adding the "Enable" box to it, I tried the order guide through the service catalog and it works as designed.  So, there is something that I am missing.  Any suggestions will be greatly appreciated.

 

UPDATE #2:  I compared the URLs of the order guide produced by the INC Convert button with the one that is produced through the service catalog and here's is the difference aside from the endings (inc=INC0010147 and referrer=recent_items):

  • From INC Convert button: https://[redacted].service-now.com/sp?id=sc_cat_item&sys_id=571de841dbdc20109c2a1780399619b8&inc=INC0010147
  • From service catalog: https://[redacted].service-now.com/sp?id=sc_cat_item_guide&sys_id=571de841dbdc20109c2a1780399619b8&referrer=recent_items

I manually added the "_guide" to the URL produced by the Convert button and press Enter.  It showed the order guide as it should display, but the field mappings that I have created did not work.  Just wanted to add this information in case it helps with troubleshooting suggestions.  Thanks.

 

joymorales
Giga Guru

Hi Narsing1 and Team.

Quick question:  Is there a way to make the service portal that opens with the catalog item form be our portal (example: /sp123) instead of the /sp one?

 

I found code in the Update Set v4 under the UI Page with the following code, which lists exactly the URL that pops up everytime, even though we have our portal set as our homepage portal default.

 

var ga = new GlideAjax('Incident_To_Request_Utils');
ga.addParam("sysparm_name", "getInstanceName");
ga.getXMLAnswer(function(instanceName) {
g_navigation.openPopup('https://' + instanceName + '.service-now.com/sp?id=sc_cat_item&sys_id=' + catitem + '&inc=' + inc);
GlideDialogWindow.get().destroy();

 

Any suggestions will be greatly appreciated.

Jeffrey Barton
Tera Contributor

I just installed this on my dev instance and set a catalog item with the portal setting of convert to incident and when I click the button none of the data from the incident is populated and if I submit the incident doesn't get touched - no notes, no closure, no linking to the new request - nothing.  It's as if it just triggers the catalog item at the point where I would order it from self service instead of adding all the info. HELP!!  i REALLY NEED THIS BUTTON.

joymorales
Giga Guru

Hi Team.

 

On my last posted request for making our service portal the portal that opened when converting an incident to a request, I found the solution.

 

In looking at the Local Update set's UI Page record, I saw that the Target Name was "catalog_item_list_v2".  I opened the UI Pages module under System UI, opened the "catalog_item_list_v2" record and made the change under the Client Script.  Changed the "sp" with our service portal URL suffix and saved the record.  Tested it and it worked.

 

var ga = new GlideAjax('Incident_To_Request_Utils');
ga.addParam("sysparm_name", "getInstanceName");
ga.getXMLAnswer(function(instanceName) {
g_navigation.openPopup('https://' + instanceName + '.service-now.com/sp?id=sc_cat_item&sys_id=' + catitem + '&inc=' + inc);
GlideDialogWindow.get().destroy();

joymorales
Giga Guru

Hi Jeffrey Barton.

 

I'm new at this too, but quick question:  Do you have your Incident and REQ fields mapped under the Incident Catalog Mappings by the field name and not the Label name?

 

joymorales_0-1671022940219.png

 

Narsing1
Mega Sage

@Jeffrey Barton 

Have you added the variable set "Standard - Incident to Request Conversion" to your catalog item and checked the Portal settings under Catalog item for "Enable for incident conversion" 

If not, please do and try again.

Thanks,

Narsing

Jacob I
Tera Expert

Narsing,

 

This is a fantastic addition. Thanks for the hard work.

 

How do we change requested by/requested for to map to the names in the incident? Currently the incident pulls using the logged on user through javascript&colon;gs.getUserID()

 

So when it's remapped on u_incident_catalog_mappings it's using javascript&colon;gs.getUserID() and not the entry in the incident.

 

 

 

Narsing1
Mega Sage

Hi,

You can use like this 

Incident Opened By = Requested By

Incident Caller = Requested for

Narsing1_0-1674099452287.png

Thanks,

Narsing

Jacob I
Tera Expert

Narsing,

 

Thanks for the response, that is a great idea i didn't think of.

 

My only other question/request is what would be the best way to move/copy attachments using your scripts? Please let me know your recommendation. 

 

Thank you.

Narsing1
Mega Sage

Hey @Jacob I 

That's a needful one.  Please download the latest version from here.

Incident To Request - V5 

 

Thanks,

Narsing

Michael Hays
Tera Expert

Hi @Narsing1 

 

2 issues

1. Cannot get variables to map over to requested item

2. Doesn't cancel my incident when I submit the request with manual entries on the catalog form fields. (not mapping over from above)

 

I have done all your steps below

1. Commit the Update

2. Go to a Catalog Item and check "Enable for Incident Conversion" that is available in "Portal Settings" Tab.

3. Add a variable set called "Standard - Incident to Request Conversion" to this Catalog Item.

4. Go to "u_incident_catalog_mappings.LIST" TABLE and start adding the entries like this. Example

    Entry#1 Catalog Item = <your catalog item> Catalog Variable Name = <your catalog variable> In order to map caller_id, this variable must be a reference pointed to sys_user. Incident Field = <incident field ex: caller_id> Sequence = 1

   Entry#2 Catalog Item = <Your catalog Item> Catalog Variable Name = short_description Incident Field = short_description Sequence = 2

5. Now, go to any Open Incident and click on "Convert to a Request" UI Action Button and provide the Catalog ITem name as "<Your Catalog Item>" and click on "Create Request"

6. It opens the SP Portal and populates the information.

 

It pops up the and I can select the request I want

Screenshot 2023-02-16 at 11.24.26 AM.png

Catalog Item Form doesn't take fields from incident and auto populate the variables

Screenshot 2023-02-16 at 11.24.46 AM.png

Mappings

Screenshot 2023-02-16 at 11.18.01 AM.png

Variable set name

Screenshot 2023-02-16 at 11.19.06 AM.png

Variables in the variable set.

Screenshot 2023-02-16 at 11.18.38 AM.png

 

Thank You in Advanced

Narsing1
Mega Sage

Hey @Michael Hays ,

Everything seems to me looking good.  Are you getting the Parameter in the URL like this that carries the incident number?

Narsing1_0-1676727484700.png

 

Thanks,

Narsing

Michael Hays
Tera Expert

I figured out my issue. I didn't realize you had created the variable set already and I just needed to add it to the specific catalog item. This works great Narsing. So much appreciated.

 

Also if you want a default catalog item to show up in the "Select Catalog Item" in the pop up.

  1. Change the ui page - "catalog_item_list_v2" line 32 
    1. from - 'g:ui_reference "name="c_item" "active=true^u_enable_for_incident_conversion=true"  table="sc_cat_item"
    2. to- g:ui_reference name="c_item" value="sys_id of catalog item" displayvalue= "Display Name of catalog item" query="active=true^u_enable_for_incident_conversion=true" table="sc_cat_item" 

For my company and team. This is all that is needed at this point in time. 

 

Screenshot 2023-02-22 at 8.15.44 AM.png

 

Also, with still using the query. Any Catalog Item you select for "Enable for Incident Conversion"=true

Will still show up when you click the microfine glass.

Screenshot 2023-02-22 at 8.17.52 AM.png

Jacob I
Tera Expert

Narsing,

 

Thanks for the v5 update. I've implemented it but cant seem to get attachments to copy over. 

 

Where is the trigger located that initiates the attachment copy or how is it supposed to work?

 

Thank you!!

Michael Hays
Tera Expert

Jacob I,

 

I had the same issue. I didn't realize until looking through the update set he had created a Variable set already named "Standard - Incident to Request Conversion". He has two variables already created too. Add your variables to that set. Also make sure you using different "incidents" to test with. Those were my issues.

Narsing1
Mega Sage

Hi, 

When Incident has any attachments, it copies to the RITM 

Script include : Incident_To_Request_Utils

Line : 90

//Copy Attachments from Incident to RITM
							try {
								var attachment = new GlideSysAttachment();
								attachment.copy("incident", parentid, "sc_req_item", ritmSYSID);
							} catch(att) {
								
							}

Thanks,

Narsing

praveen rudroj1
Tera Explorer

Hi Narsing,

Thank you for sharing this knowledge and resources. Greatly appreciated.

 

I have a one more requirement, Can I map multiple Incident fields to single catalog variable name, below is an example I'm trying to ask

 

Multiple incident fields to single catalog variable name

praveenrudroj1_0-1679565109245.png

 

Output should be

praveenrudroj1_1-1679565252196.png

 

Thanks & Regards,

Praveen Rudroju.

 

 

need to ask one more

 

Narsing1
Mega Sage

Hi @praveen rudroj1 

I will make a note of it and come up in next release.

Thanks,

Narsing

manish kale
Tera Guru

Hello @Narsing1 

I am facing an issue. Originally when incidents are converted to requests the state is changed to cancelled. In my case I have added a new state named as 'Converted to Request' which is set after the conversion of incidents to requests . And everything works perfect. 
The only problem I am facing is after few months the 'assigned to' person of those converted incidents gets a email notifications regarding the same converted incidents stating "Incident INC00***** assigned to you has been opened for a week or more", acting as open incidents.

If you could help me with this it would be really very appreciated.

Thanks & Regards
Manish 

CecileC
Tera Contributor

In the process to convert the incident to a request, do you know if ther is a way to modify of the catalog page?

Is it possible to make it look like the portal view (with a submit button instead of order now button, no quantity, no shopping cart...)?

 

Thank you.Convert incident to request.png

Ajinkya Gothosk
ServiceNow Employee
ServiceNow Employee

Hi,

 

Thank you for sharing this, it has been very helpful! Once the request has been generated from the incident, will it automatically follow the request workflow that has been implemented? Even if that workflow is different to the OOTB workflow? 

 

Thanks

Narsing1
Mega Sage

That is correct.  Once the request is generated, it follows the workflow/flow that is attached to that catalog item.

 

Thanks,

Narsing

Madhavi Ravulap
Tera Explorer

@Narsing1  I'm seeing the following error when I try to create a request. Can you please help?Errorscreenshot.PNGScreenshot2.PNG

Vamsi_Krishna07
Tera Contributor

Hi @Narsing1 ,

 

Your code to copy attachments from Inc to Ritm is not working. I loaded the latest V5 update set.

//Copy Attachments from Incident to RITM
							try {
								var attachment = new GlideSysAttachment();
								attachment.copy("incident", parentid, "sc_req_item", ritmSYSID);
							} catch(att) {
								
							}

 Any inputs from your side? 

manueleriklego
Tera Expert

Hi @Narsing1 - I am fairly new in Servicenow and I have the same requirement and came across on this one. This is indeed very helpful. I imported the update sets to my personal instance and follow the instructions I am having issues to populate the variables even though I did the mapping. I am using vancouver release. Appreciate your help in advance.

here's the error:

manueleriklego_0-1719246897531.png

 

Narsing1
Mega Sage

Hi @manueleriklego 

The below catalog client script for the variable set is already deactivated.

Name: OnLoad Check Incident

If the above client script is showing as active, then deactivate that

Narsing1_0-1719249656564.png

Thanks,

Narsing

manueleriklego
Tera Expert

Thank you @Narsing1 , This helps greatly!

manueleriklego
Tera Expert

Hello @Narsing1 - This is really a huge hit for us! I was able to change some configuration based from our requirement but I need to check with you if this covers your development. 

From Incident from: I have added the requested - Parent  to the related list and can see the ritm created perfectly.

manueleriklego_0-1719845059895.png


But from RITM form, I added incident - parent to the related list but incident number does not show.

manueleriklego_1-1719845098188.png

 

Any idea maybe where I can start looking/checking?

Narsing1
Mega Sage

Hi @manueleriklego 

You need to create either a custom relationship / can bring the Parent field into the RITM form as when it comes to RITM, you need to display the Parent Incident and not Parent=RITM

 

Create something like this in Relationship

 

Screenshot 2024-07-02 092622.png

Screenshot 2024-07-02 092755.png

 

Thanks,

Narsing

 

Joseph003
Tera Contributor

Hi @Narsing1 

Thanks for the hard work!! this is a Great time saver!!

I've everything got to work but wondering is there way that we could address the "Incident catalog mappings" ? for multiple catalog items.
For example: we've got 100's of catalog items that needs to have the incident "caller" field mapped to "requested for" and short description to short description etc.., to ALL the catalog item unless there are some additional or special variables/catalog items that needs additional attention that I can take advantage of "Incident catalog mappings"

Is there a way to shoot the two birds at one shot ?

Thanks,
Joseph. 



Narsing1
Mega Sage

Hi @Joseph003 

You may think of doing a bulk update by using "item_option_new" table, filter by type = Reference & Reference = sys_user table.

Since we don't know how the developers use their variable names for short description and requested for fields, and mappings will be one-one, we can't combine both which is I think ok as it always has an option to do the bulk update as I mentioned above.

 

Thanks,

Narsing

phugill
Tera Contributor

Hello,

 

This is a great tool and I am excited to use this, however everything works but the Incident closing. 

Request is created values populate but the incident does not close. Has anyone else experienced this implementing this solution? 

Version history
Last update:
‎01-22-2023 12:32 AM
Updated by:
Contributors