- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-04-2025 01:28 AM
Hello,
how to set up the following : I want to be able to assign the change request to myself by a button 'Assign To Me', and only Visible in state 'New, Assess', and On Click the field ‘Assigned to’ should filled with the logged in user.
I create a UI Action :
Name: Assign To Me
Table: Change Request (change_request)
Action Name: assign_to_me
Condition:
(current.state == 'new' || current.state == 'assess');
Script :
current.assigned_to = gs.getUserID();
current.update();
action.setRedirectURL(current);
And other options checked :
The problem is that the button is greyed out :
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-04-2025 02:36 AM - edited 03-04-2025 02:40 AM
You should use choice value but you are using choice label.
current.state.toString() == '-5' || current.state.toString() == '-4'
I will also recommend to add the extra condition so that it only shows the CHG which are unassigned
(current.state.toString() == '-5' || current.state.toString() == '-4') && current.assigned_to == ''
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-04-2025 02:41 AM
check my response below for solution.
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-04-2025 02:36 AM - edited 03-04-2025 02:40 AM
You should use choice value but you are using choice label.
current.state.toString() == '-5' || current.state.toString() == '-4'
I will also recommend to add the extra condition so that it only shows the CHG which are unassigned
(current.state.toString() == '-5' || current.state.toString() == '-4') && current.assigned_to == ''
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-04-2025 03:46 AM
Thanks Ankur : it worked 👍( and sorry i didn't see you reply in real time 🙏)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-04-2025 02:44 AM
Hi @yasserbouat
You are doing wrong in condition
Here is sample
current.state == 1&& current.contact_type == 'self-service' || current.contact_type == 'self-service' && current.state != 7 || current.state != 6
Replace the new and assess with the state number like here it is mentioned.
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
03-04-2025 03:33 AM
Does someone please have a suggestion ?