How to add Edit related list action button

Alon Grod
Tera Expert

Hi,

 

im trying to add Edit related list action button in SOW on sys_user_grmember related list that on sys_user_group record. Can anyone help and share the configuration and the script?

4 REPLIES 4

J Siva
Tera Sage

Hi @Alon Grod 
Please follow the below community article to create/enable "Edit" button on the related lists in workspaces.
https://www.servicenow.com/community/developer-articles/solved-workaround-for-quot-edit-quot-buttons...
Hope this helps.
Regards,
Siva

Ankur Bawiskar
Tera Patron
Tera Patron

@Alon Grod 

for workspace it's treated differently.

this article from Maik will help you create that

SOLVED: Workaround for "Edit ..." buttons on Related Lists of Workspaces 

Also check this link

Workspace for a custom app: buttons 

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

@Alon Grod 

Hope you are doing good.

Did my reply answer your question?

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

Shree_G
Kilo Sage

Hello @Alon Grod ,

 

I was able to create a "Edit" button by following below steps on "sys_user_grmember" table in Workspace.

 

1. Go to "Now Experience Framework" -> "Declarative Actions" -> "Related List Actions".

 

ShirishGhule1_0-1743423223291.png

 

2. Create "New" related list action and fill details like below :

 

ShirishGhule1_1-1743423336712.png

 

3. "Save" and click on Advance view to get "Conditions" section. Fill the condition as below :

 

parent.canWrite() && parent.getTavleName() == 'sys_user_grmember'

 

4. In Client Script paste below code. Which maps the relationship between User and Group.

 

function onClick() {
    var _strLink =
        '/sys_m2m_template.do?' +
        'sys_is_list=true&' +
        'sys_is_related_list=true&' +
        'sysparm_collectionID=' + g_form.getUniqueValue() + '&' +
        'sysparm_query=&' +
        'sysparm_referring_url=' + location.pathname + '&' +
        'sysparm_stack=no&' +
        'sys_target=sys_user_grmember&' +
        'sysparm_m2m_ref=sys_user_grmember&' +
        'sysparm_collection=sys_user&' +
        'sysparm_collection_key=user&' +
        'sysparm_collection_label=Group&' +
        'sysparm_collection_related_field=group&' +
        'sysparm_collection_related_file=sys_user_group&';

    var win = top.window.open(_strLink, '_self');

    win.focus();
}

 

ShirishGhule1_3-1743423613411.png

 

 

 

5. Save and Done. You will be able to see the edit button on SOW.

 

ShirishGhule1_2-1743423582637.png

 


If this solution helped resolve your issue, please consider marking it as helpful or correct.
This will assist others in finding the solution faster and close the thread.