oon catalog task creating ui actions

kandunurimahesh
Tera Contributor

In request item whenever short description starts with QA and user is from hardware group then show ui action button on catalog task whenever user click the button catalog task state should be closed complete

4 REPLIES 4

Amit Gujarathi
Giga Sage
Giga Sage

Hi @kandunurimahesh ,
I trust you are doing great.

  1. Create a UI Action:
    • Navigate to "UI Actions" in the ServiceNow application.
    • Click on "New" to create a new UI action.
    • Provide a name for the UI action, such as "Close Catalog Task."
    • Set the Table to "Catalog Task."
    • In the "Advanced" section, select "Show Insert/Update" to display the UI action button on the form.
    • In the "Action" field, enter the following JavaScript code:

 

if (current.short_description.startsWith('QA') && current.assignment_group.name === 'Hardware Group') {
  gs.addInfoMessage('Clicking this button will close the catalog task.');
  current.state = 3; // 3 represents 'Closed Complete' state
  current.update();
}

 

  1. Add Conditions to the UI Action:

    • In the "Conditions" section of the UI action form, add the following conditions:
      • Table: Request Item
      • Action Name: Insert
  2. Save the UI Action and Test:

    • Click on "Save" to save the UI action.
    • Go to a Request Item form where the short description starts with "QA" and the user is assigned to the "Hardware Group."
    • You should now see the UI action button labeled "Close Catalog Task."
    • When clicked, it will close the associated catalog task and display a message indicating the action has been performed.

Was this answer helpful?


Please consider marking it correct or helpful.


Your feedback helps us improve!


Thank you!


Regards,


Amit Gujrathi



Thank you

 

 

Anurag Tripathi
Mega Patron
Mega Patron

Create a ui action on ritm with the following condition

currrent.short_descripotion.startsWith('QA') && gs.getUser().isMemberOf('<Group name or sys_id>')
-Anurag

Thank you