Creating a child request and passing variables.

ServiceNowSteve
Giga Guru

Good Afternoon All,

I hope everybody had a great holiday break! I am getting back to work on requests for our ServiceNow implementation and one lingering request is something that existed in our old system that I cannot figure out a good way to replicate in ServiceNow.

Background:

In our business we send out equipment to field locations. In our old ticketing system we use to be able to create an RMA for a piece of equipment by pressing a button on the incident form which would spawn a child RMA ticket.

The current issue:

With ServiceNow it seems like there is something similar in that you can select "Create Request" from a drop down but the problem is that when you do it takes you to the Service Catalog to fill out a long form. In our old system the ticket would be created as an incident and some basic information would be pre-populated like the caller, the fact it was an RMA, etc..

Any suggestions on how I can replicate ths old way as close as possible in ServiceNow?

Request.png

1 ACCEPTED SOLUTION

oharel
Kilo Sage

I think you have two immediate options that I can think of:


1. create a child incident by adding a UI action that will both create the incident and insert the values in it.


2. create your own RMA app that on clicking a UI action, will open a new record related to the incident.



The advantage of the first option is that you only have to create the UI action, for example:



createChild();


function createChild() {



var inc = new GlideRecord('incident');


inc.initialize();


inc.caller_id = current.caller_id;


inc.parent_incident = current.sys_id; //or whatever you called the parent field


inc.description = current.description


//.. etc etc


inc.insert();


}



There might be oob solutions for that, though, of which I am not aware.


harel


Forgot to add the part about the custom RMA: that's an option, of-course, but would require much more work like adding tables, security, UI actions etc.


View solution in original post

4 REPLIES 4

oharel
Kilo Sage

I think you have two immediate options that I can think of:


1. create a child incident by adding a UI action that will both create the incident and insert the values in it.


2. create your own RMA app that on clicking a UI action, will open a new record related to the incident.



The advantage of the first option is that you only have to create the UI action, for example:



createChild();


function createChild() {



var inc = new GlideRecord('incident');


inc.initialize();


inc.caller_id = current.caller_id;


inc.parent_incident = current.sys_id; //or whatever you called the parent field


inc.description = current.description


//.. etc etc


inc.insert();


}



There might be oob solutions for that, though, of which I am not aware.


harel


Forgot to add the part about the custom RMA: that's an option, of-course, but would require much more work like adding tables, security, UI actions etc.


I'll give it a try and see what happens. Thanks for the reply!


ServiceNowSteve
Giga Guru

This worked out well. Thank you very much!


michalmichal
Tera Contributor

Hi,

This is exactly what I was looking for- Thank you!

Something doesn't work for me, I have a custom task table that I use for cases and I want the child task case to inherit fields from the parent case.

Can you please help me to understand what may be wrong here?

createChild();
function createChild() {

var newchildcase = new GlideRecord("case");
newchildcase.initialize();
newchildcase.priority = current.priority;
newchildcase.u_platform = current.u_platform;
newchildcase.u_farm = current.u_farm;
newchildcase.u_subject = current.u_subject;
newchildcase.u_steps_to_replicate = current.u_steps_to_replicate;
newchildcase.u_case_type = current.u_case_type;
newchildcase.short_description = current.short_description;
newchildcase.opened_by = current.opened_by;
newchildcase.parent = current.parent;
newchildcase.insert();

}