The CreatorCon Call for Content is officially open! Get started here.

How can I get the Edit button functionality on user table which is in related list?

Jitendra Diwak1
Kilo Sage

How can I get the Edit button functionality on user table which is in the related list? I just created a Add UI Action button on user table and trying to achieve all functionality which is provided by Edit button

my code is here

var uri = action.getGlideURI();
var path = uri.getFileFromPath();
var collectionId = uri.get('sysparm_collectionID');
var collectionKey = uri.get('sysparm_collection_key');

uri.set('sysparm_m2m_ref', 'sys_user_group');
uri.set('sysparm_stack', 'no');

if (collectionKey == '') {
    uri.set('sys_is_list', 'true');
    uri.set('sys_is_related_list', 'true');
    uri.set('sys_target', 'sys_user_grmember');
    uri.set('sysparm_checked_items', '');
    uri.set('sysparm_collection', 'sys_user');
    uri.set('sysparm_collectionID', 'sys_id');
    uri.set('sysparm_collection_key', 'user');
    uri.set('sysparm_collection_label', 'Groups');
    uri.set('sysparm_collection_related_field', 'group');
    uri.set('sysparm_collection_related_file', 'sys_user_group');
    uri.set('sysparm_collection_relationship', '');
    uri.set('sysparm_fixed_query', 'NOTIN');
    uri.set('sysparm_group_sort', '');
    uri.set('sysparm_list_css', '');
    uri.set('sysparm_m2m_ref', 'sys_user_grmember');
    uri.set('sysparm_query', '');
    uri.set('sysparm_referring_url', 'sys_user.do');
}

action.setRedirectURL(uri.toString('sys_m2m_template.do'));

find_real_file.png

I cannot filter the group the user belongs to and Cancel and Save button is not also working.

Thanks in advance

Please accept my solution if it works for and thumps up.
4 REPLIES 4

asifnoor
Kilo Patron

To enable the edit button in the related list, follow the below steps.

In the related list, click on any column context menu and go to list control. In the list control, you will see a button "Enable Edit". Click on that and save. Then edit button will be visible.

Mark the comment as a correct answer and also helpful once worked.

I have created Add in Group button and want all functionality of Edit button on Add in Group this button and I am not trying to hide or show edit button .

Please accept my solution if it works for and thumps up.

Not sure, why you need to create another when you already have an inbuilt Edit button that you can use.

 

Please solve this one https://community.servicenow.com/community?id=community_question&sys_id=5fe25f0fdb807380e0e80b55ca9619c1

Please accept my solution if it works for and thumps up.