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.

Convert Incident to SCtask

Gemma4
Mega Sage

Hi Everyone,

I am trying to be able to create a Request/sctask from the Incident form to allow technicians to convert the incidents to the proper ticket when a users submits incorrectly. I followed the steps below but all that is happening is a request is created but the fields are not getting converted and there are no worknotes added to the new request referencing the original incident. 

Below is a summary of what I've done:

UI Action

Client script

details attached

full details in Kb https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0694006

thanks in advance for any feedback you can provide!

Gemma

 

3 REPLIES 3

AshishKM
Kilo Patron
Kilo Patron

Hi @Gemma4 , 

You can add following line client script for work notes transfer.

 

g_form.setValue("work_notes", grINT.work_notes);

 

-Thanks,
AshishKMishra


Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution

Thank you @AshishKM . I added above but unfortunately the request simply gets created and none of the information from the incident is copied to the request. 

I think I got things finally working. Thanks all. However, I'm receiving the following error and was curious if anyone else has

Message
Exception (ReferenceError: "current_cart_item" is not defined. (sys_script.525595361be22110ecf1639b234bcbd4.condition; line 1)) occured while evaluating'Condition: current_cart_item!==null; Filter Condition: short_descriptionISEMPTY^EQ' in business rule 'Set Req Short Descrip By Catalog works' on sc_request: REQ0010414; skipping business rule
 
Below are the ui action details
I am having trouble adding a message to display the request number just created..
 

var url = 'https://dev173960.service-now.com/now/nav/ui/classic/params/target/sc_request.do%3Fsys_id%3D-1';
url = 'sc_request.do?sysparm_incident_id=' + current.sys_id;
action.setRedirectURL(url);
//action.setRedirectURL(current);
var incidentRequest = (new IncidentUtils()).createRequest(current);
gs.addInfoMessage(gs.getMessage("Request {0} was created", incidentRequest));
//gs.getMessage('Problem created from Interaction {0}', current.number));

//gs.addInfoMessage(gs.getMessage("Request {0} was created", current.number)));

 

//gs.addInfoMessage('Problem created from Interaction {0}', current.number));+

//gs.addInfoMessage(gs.getMessage("Request {current.number} was created", current.incidentRequest));
// gs.addInfoMessage(gs.Message("Defect {0} created",request.number));

current.state='7';
current.work_notes="Created REQ";
current.close_code='6';
current.close_notes="Created REQ";
current.update();

//////////var you_are_elle_path = 'sc_request.do?sysparm_incident_id=' + current.sys_id;
/////////action.setRedirectURL(you_are_elle_path);