How to create a change record from UI action on incident form.

Sourab
Kilo Contributor

How to create a change record from a UI action on incident form and pass some details to the change record such as,  short description from the incident form or any other field.

Thanks

1 ACCEPTED SOLUTION

Here is the sample code which maps incident details to change and creates a change record.

var change = new GlideRecord("change_request");
change.initialize();
change.short_description = current.short_description; // incident Short description mapped to change short description.
change.description = current.description;
change.cmdb_ci = current.cmdb_ci;
change.priority = current.priority;
var changesysID = change.insert();
action.setRedirectURL(change);




Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP

View solution in original post

11 REPLIES 11

VigneshMC
Mega Sage

OOB servicenow provides context menu to create change, you can use them.

find_real_file.png

Voona Rohila
Mega Patron
Mega Patron

We already have OOTB for this

Check below UI Actions in incident table in your instance for reference.

  1. Create Change Request
  2. Create Normal Change
  3. Create Standard Change
  4. Create Emergency Change

Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP

Sourab
Kilo Contributor

I need script for UI action

Not sure why you want to create a custom ui action when you have OOB, but you want to custom ui action , then below thread should be helpful

https://community.servicenow.com/community?id=community_question&sys_id=81305be5dbdcdbc01dcaf3231f96191b