From incident to service request as covert request button in incident form

AJAYKUMAR G
Tera Contributor

From incident to service request as covert request button in incident form

 

Particular catalog item targeting from incident

 

Button 

 

Incident caller is requestor for 

When button is created incident as canceled.

7 REPLIES 7

@AJAYKUMAR G 

it's already there OOB.

what's your question?

Also I shared another link to have custom solution. Did you check that?

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

AndersBGS
Tera Patron
Tera Patron

Hi @AJAYKUMAR G ,

 

As @Ankur Bawiskar have mentioned, this is already available OOTB. If you need some additional modification to the OOTB solution, then this can be configured through UI Action.

 

If my answer has helped with your question, please mark my answer as the accepted solution and give a thumbs up.

Best regards
Anders

Rising star 2024
MVP 2025
linkedIn: https://www.linkedin.com/in/andersskovbjerg/

Veer
Tera Guru

Hello @AJAYKUMAR G 

Please follow the below steps

  • Navigate to UI Actions:

    • Go to the Application Navigator.
    • Type UI Actions in the filter.
    • Click on UI Actions under System Definition.
  • Create a New UI Action:

    • Click on the New button to create a new UI Action.
    • Set the properties for the UI Action:
      • Name: Convert to Request
      • Table: Incident
      • Action name: convert_to_request
      • Show insert: True
      • Show update: True
      • Form button: True (this makes it appear as a button on the Incident form).
      • Condition: true (or specify any condition under which the action should appear, e.g., 
  • Script for UI Action: In the Script field of the UI Action, paste the following code:

     

 

 

var cartId = GlideGuid.generate(null);
var cart = new Cart(cartId);

// Add the requested item to the cart using the sys_id of the catalog item
var item = cart.addItem('sysId of the catalog item', 1);

// Fill in the variables on the request item form
cart.setVariable(item,"u_requested_for", current.caller_id.toString()); 

// Create the cart order
var rc = cart.placeOrder();

// Change the caller of the incident to requested for and incident state to cancelled
current.caller_id = current.u_requested_for;  // Assuming u_requested_for is the field used
current.state = 3;  // 3 corresponds to 'Cancelled' in the Incident state field (you can adjust the value based on your state configuration)
current.update();

// Optionally, add a message to notify the user that the action was completed
gs.addInfoMessage('Incident converted to request and state set to Cancelled.');

 

 

 
  • Save the UI Action:

    • Click the Submit button to save the UI Action.

Please mark this as helpful / accepted solution if it resolves your query.

Thanks & Regards

Veer