Assign to Me Button: How to configure on an SCTASK record similar to an INC record.

Xavier_Wharton
Giga Guru

Hello fellow Admins, 

I received a request to configure an Assign to Me button for fulfillers on the SCTASK record. How would I do this to mimic the action and design of what is available on the INC form? 

See examples below.

CURRENT Incident Form > Service Operations WorkspaceCURRENT Catalog Task (SCTASK) Form > Service Operations Workspace
XavierWharton1_0-1709239999466.png

 

XavierWharton1_0-1709251710682.png

 

4 ACCEPTED SOLUTIONS

Hi @Xavier_Wharton 

 

I am not coder 😤 but can help you more. I saw OOTB this button available on Change task

 

Have a look on same 

 

AGLearnNGrow_0-1709378252570.png

 

https://INSTANCENMAE.service-now.com/now/nav/ui/classic/params/target/sys_ui_action.do%3Fsys_id%3D3987cbbe23003300a282fa9e27bf655c%26sysparm_record_target%3Dsys_ui_action%26sysparm_record_row%3D1%26sysparm_record_rows%3D7%26sysparm_record_list%3DnameSTARTSWITHAssign%255EtableCONTAINStask%255EORDERBYorder

*************************************************************************************************************
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]

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

View solution in original post

Bert_c1
Kilo Patron

The following UI action (copied from "Assign to me" defined on the change_task table) worked for me:

 

Screenshot 2024-03-02 135552.pngScreenshot 2024-03-02 135636.png

 

Appears on the sc_task form. Maybe this will work for you.

View solution in original post

shyamkumar VK
Kilo Patron

@Xavier_Wharton ,

Follow Below Process

 

1.Navigate to UI Actions in the backend. Filter Assign to me button for sc_task , Open the record 

2.Scroll to the bottom of Ui action and check the workspace related checkboxes, and add the script in the script field.

 

function onClick(g_form) {
    assignToMe();

    function assignToMe() {
        g_form.setValue("assigned_to", g_user.userID);
		g_form.submit(g_form.getActionName());
    }
}

 

Let me know if you need any more help

 

Regards,

Shyamkumar

 

 

Please mark this as helpful and accept as a solution if this resolves your Ask.
Regards,

Shyamkumar

View solution in original post

Xavier_Wharton
Giga Guru

Thank you all for your assistance!!!!

I was able to take suggestions from everyone who replied, and I added a few additional steps to successfully configure the "Assign to Me" button on the classic and Service Operations Workspace task record. 

See the full steps below.

(function() { var assignedToFieldLabel = sys_meta[current.getRecordClassName()]["assigned_to"].label; if (!current.assigned_to.canWrite()) { gs.addErrorMessage(gs.getMessage("You do not have permission to update the {0} field", [assignedToFieldLabel])); return; } if (!current.assignment_group.nil() && !gs.getUser().isMemberOf(current.assignment_group.toString())) { gs.addErrorMessage(gs.getMessage("{0} user must be a member of the \"{1}\" group ", [assignedToFieldLabel, current.assignment_group.getDisplayValue()])); return; } current.assigned_to = gs.getUserID(); current.update(); })(); ​ XavierWharton1_14-1709604590209.png

 

Step NumberDescriptionExample
1

I looked up the existing "Assign to Me" UI action related to the Change Table.

Table: Type sys_ui_action.list in the All Menu.

XavierWharton1_10-1709604316478.png

 

2I opened the Change able record and used the "Insert and Stay" function to copy the record and renamed it "Assign to me (SCTASK)".XavierWharton1_11-1709604372696.png

 

3

I opened the new "Assign to me (SCTASK)" record and made the following changes:

 

Top Half

1. Action name changed to sctask_assign_to_me

2. Checked the following boxes:

- Active

- Show insert

- Show update

- Form button

- List context menu

Bottom Half

- Workspace For Button-see step 4-Format for Configurable Workspace

XavierWharton1_12-1709604529131.pngXavierWharton1_13-1709604538274.png

 

4I inputted the following code within the Workspace Client Script field:



View solution in original post

7 REPLIES 7

shyamkumar VK
Kilo Patron

@Xavier_Wharton ,

Follow Below Process

 

1.Navigate to UI Actions in the backend. Filter Assign to me button for sc_task , Open the record 

2.Scroll to the bottom of Ui action and check the workspace related checkboxes, and add the script in the script field.

 

function onClick(g_form) {
    assignToMe();

    function assignToMe() {
        g_form.setValue("assigned_to", g_user.userID);
		g_form.submit(g_form.getActionName());
    }
}

 

Let me know if you need any more help

 

Regards,

Shyamkumar

 

 

Please mark this as helpful and accept as a solution if this resolves your Ask.
Regards,

Shyamkumar

Xavier_Wharton
Giga Guru

Thank you all for your assistance!!!!

I was able to take suggestions from everyone who replied, and I added a few additional steps to successfully configure the "Assign to Me" button on the classic and Service Operations Workspace task record. 

See the full steps below.

(function() { var assignedToFieldLabel = sys_meta[current.getRecordClassName()]["assigned_to"].label; if (!current.assigned_to.canWrite()) { gs.addErrorMessage(gs.getMessage("You do not have permission to update the {0} field", [assignedToFieldLabel])); return; } if (!current.assignment_group.nil() && !gs.getUser().isMemberOf(current.assignment_group.toString())) { gs.addErrorMessage(gs.getMessage("{0} user must be a member of the \"{1}\" group ", [assignedToFieldLabel, current.assignment_group.getDisplayValue()])); return; } current.assigned_to = gs.getUserID(); current.update(); })(); ​ XavierWharton1_14-1709604590209.png

 

Step NumberDescriptionExample
1

I looked up the existing "Assign to Me" UI action related to the Change Table.

Table: Type sys_ui_action.list in the All Menu.

XavierWharton1_10-1709604316478.png

 

2I opened the Change able record and used the "Insert and Stay" function to copy the record and renamed it "Assign to me (SCTASK)".XavierWharton1_11-1709604372696.png

 

3

I opened the new "Assign to me (SCTASK)" record and made the following changes:

 

Top Half

1. Action name changed to sctask_assign_to_me

2. Checked the following boxes:

- Active

- Show insert

- Show update

- Form button

- List context menu

Bottom Half

- Workspace For Button-see step 4-Format for Configurable Workspace

XavierWharton1_12-1709604529131.pngXavierWharton1_13-1709604538274.png

 

4I inputted the following code within the Workspace Client Script field:



Good to know @Xavier_Wharton 

 

If you think we all help , please accept answer as solution to motivate all. 

*************************************************************************************************************
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]

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