User Requirement Could you plz provide code
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-02-2024 09:29 AM
- Create a new UI Action on Change Request - Create Task
- This button should be visible only in New/Assess state and to the Assignee of the ticket.
- When user clicks on Create Task, user should be redirected to new Change Task form and below fields should be copied from Change Request to Change Task:
- Configuration Item
- Short Description
- Description
- Assignment Group
- Assigned To - If there is already an active Change Task for the same Configuration Item, stay on the Change Request form and display an Error Message - "Change Task is already active for the same Configuration Item".
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-02-2024 09:42 AM
Hi @mahesh_03
- Create a new UI Action on Change Request - Create Task
Atul: On change request we already have related list named change task and there you will find New Button.
- This button should be visible only in New/Assess state and to the Assignee of the ticket.
Atul: You can modify the behaviour of that UI action
- When user clicks on Create Task, user should be redirected to new Change Task form and below fields should be copied from Change Request to Change Task:
- Configuration Item
- Short Description
- Description
- Assignment Group
- Assigned To
Atul : check OOTB logic.
- If there is already an active Change Task for the same Configuration Item, stay on the Change Request form and display an Error Message - "Change Task is already active for the same Configuration Item".
Atul: Add behaviour, with loop to check is any active task and show message.
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-02-2024 11:10 PM - edited ‎02-02-2024 11:12 PM
Hi @mahesh_03 please find the below UI Action for the same, follow the steps as per screen shot and copy the script shared
UI Action cond: (current.state == -5 || current.state == -4) && current.assigned_to == gs.getUserID()
Script:
Harish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-04-2024 07:09 AM
I checked the above code not working as expected could you please check it once

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-04-2024 05:24 PM - edited ‎02-04-2024 05:24 PM
Hi @maheshchokkara the shared code works fine in my PDI. you can share your entire UI action we can check
Harish