Create Request (UI action) button

Sushant20
Tera Contributor

On the incident form, we have a create Request button to create a request. when we create a request from incident then automatically we need to add worknotes on incident as "The Ritm(number) has been created and on Ritm we need add worknote as "The incident(number) has been created.

 

Thank you in advance!!

5 REPLIES 5

jaheerhattiwale
Mega Sage
Mega Sage

@Sushant20 Tried and tested solution.

 

you can add below code in ui action

 

var ritm = new GlideRecord("sc_req_item");
ritm.initialize();
ritm.short_description = current.short_description;
ritm.work_notes = "The incident("+current.number.toString()+") has been created";
ritm.insert();

current.work_notes = "The Ritm("+ritm.number.toString()+") has been created";
current.update();
action.setRedirectURL(current);
 
Please mark as correct answer if this solves your issue.

 

Please mark the answer as correct or helpful based on impact
ServiceNow Community Rising Star, Class of 2023

Hi @jaheerhattiwale ,

Its creating a new RITM which we dont want just it should add RITM number in incident and incident number in RITM

Laszlo Balla
ServiceNow Employee
ServiceNow Employee

What is the code in your UI action?

we have written when you click on Create Request button it will take you to the service catalog to create a request.

Sushant20_0-1671788799776.png