Issues with populating REQ fields with INC fields after conversion
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2023 06:35 AM
Hi Team.
I am trying to populate the REQ form fields with INC form fields after conversion to REQ. I have the following UI Action for the conversion and it works fine.
I have the following on-Load Client Script for populating the REQ fields with INC fields info. The "Requested_for", "Company", and "Short Description" fields populate fine. The "u_Category" and "u_Subcategory" fields populate with the value (all lower case) instead of the Label info. The rest of the fields do not populate.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2023 06:40 AM
Hi @joymorales
What exactly is your intention with this? Requests should not be used in this way.
Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2023 07:06 AM
Hi @joymorales ,
Seems like you are trying to transfer the incident data to service request and that UI action should create service request with some incident data.
You have to use cart class and catalog item for placing this service request order from Incident UI Action
var cart = new Cart(cartId);
Refer below for code.
Let us know if it works for you.
-Thanks,
AshishKMishra
Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2023 08:19 AM - edited 11-20-2023 10:09 AM
Hi @joymorales,
If you go ahead, you can achieve your goal by updating the UI Action with the following script:
action.setRedirectURL(current);
var incidentRequest = (new IncidentUtils()).createRequest(current);
gs.addInfoMessage(gs.getMessage("Request {0} was created", incidentRequest));
And adding the following function to the 'IncidentUtils' script include:
createRequest: function(currentIncident) {
// create sc_request record
var gr = new GlideRecord('sc_request');
gr.setValue('requested_for', currentIncident.caller_id);
gr.setValue('company', currentIncident.company);
gr.setValue('u_category', currentIncident.category);
gr.setValue('u_subcategory', currentIncident.subcategory);
gr.setValue('short_description', currentIncident.short_description);
gr.setValue('description', currentIncident.description);
gr.setValue('assignment_group', currentIncident.assignment_group);
gr.setValue('assigned_to', currentIncident.assigned_to);
gr.setValue('state', currentIncident.state);
var requestId = gr.insert();
gs.info('createRequest: created request: ' + requestId);
gr.get(requestId);
// update incident fields
current.state='7';
current.work_notes="Created " + gr.number;
current.close_code='6';
current.close_notes="Created " + gr.number;
var updResult = current.update();
gs.info('createRequest: incident update: ' + updResult);
return "<a href='/sc_request.do?sysparm_query=number=" + gr.number +"'>" + gr.number + "</a>";
},
Add after " /***************Custom changes****************/ "
(Taken from "Create Security Incident" UI action defined on the incident table).