Get a first look at what's coming. The Developer Passport Australia Release Preview kicks off March 12. Dive in! 

"Assign to me" Button

yasserbouat
Tera Guru

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 : 

yasserbouat_0-1741080338257.png

 

The problem is that the button is greyed out : 

yasserbouat_1-1741080469210.png

 



1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron

@yasserbouat 

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.

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

View solution in original post

12 REPLIES 12

Dr Atul G- LNG
Tera Patron

Hi @yasserbouat 

 

Assigning to me is out-of-the-box; you just need to modify the conditions to add visibility.

*************************************************************************************************************
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/dratulgrover [ Connect for 1-1 Session]

****************************************************************************************************************

thanks for your reply,

I used the one existing in the instance and i added only the condition (current.state == 'new' || current.state == 'assess'); but it still greyed out : 

yasserbouat_0-1741083561754.png

yasserbouat_1-1741083648399.png

 



Hi @yasserbouat 

 

This is the expected behavior, as the user will not be able to use the list action if it is grayed out

*************************************************************************************************************
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/dratulgrover [ Connect for 1-1 Session]

****************************************************************************************************************

can you please tell me what to do in order to make the button "assign to me" clickable ?