Custom Table when pulled as a related list, 'Edit' button on the RL does not give all records

Salma Laskar
Tera Expert

Hi,

A custom table say 'u_test_table' created with only two reference field 'Task' referencing to task table and 'CTR' field referencing to test result table.

when this custom table is pulled on the test result table as a related list, as an admin when 'Edit' button is clicked, it does not give all the tasks under collection slush bucket. The bucket on left side from which we want to pull tasks on the bucket on right side in 'sys_m2m_template' form.

However, if we open the custom table from the navigation and try entering new data in the table, we can select all tasks on the reference field 'Task' on the custom table.

 

Please let know if you can identify the reason for it.

 

Thanks!

1 ACCEPTED SOLUTION

Salma Laskar
Tera Expert

Hello Folks,

 

Thank you for all your responses. Appreciate it sincerely!

 

I did raise a hi case with servicenow support and got this resolved. Here is what was needed - 

 

Create a custom UI action say "Edit..." with below configurations (this is specific to my use case).

Table : sn_vulc_m2m_test_result_task {this is the custom m2m table that I've created}

Action name : sysverb_edit_o2m {you might want to keep it exactly this}

Active : True

Show insert : True

Show update : True

List banner button : True

Condition : (new GlideRecord(current.getTableName())).canWrite() && RP.isRelatedList() && !RP.getListControl().isOmitEditButton()

Script : 

var uri = action.getGlideURI();
var path = uri.getFileFromPath();
uri.set('sysparm_m2m_ref', current.getTableName());
uri.set('sysparm_stack', 'no');
uri.set('sysparm_query', '');
uri.set('sysparm_collection_related_field', 'u_task'); //{'u_task' this is the custom field on the custom m2m table referencing to [task] table}
uri.set('sysparm_collection_related_file', 'task'); // {Task table - all of the records from this table are to be displayed on the left slush bucket under collection}
action.setRedirectURL(uri.toString('sys_m2m_template.do'));

View solution in original post

12 REPLIES 12

Mark Manders
Mega Patron

Since it's custom, it will be hard to tell with just this info. 
Do you have any default filters configured, any ACL issues on the m2m table (have you done any kind of (security) debugging)? Are there any reference qualifiers on the field? Is there a common thing for the records that aren't shown (like inactive, or anything like that)?


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark

Salma Laskar
Tera Expert

Hi Mark,

Thanks for replying on the post.

to give the exact context:

there is an OOB m2m table [sn_vul_m2m_item_task] - which has two reference fields 'Task' and 'Vulnerable item'.

this has been pulled on the 'Vulnerable item' table [sn_vul_vulnerable_item].

So needed the exact functionality for Test Result table [sn_vulc_result].

Created the custom m2m table [sn_vulc_m2m_result_task]

And replicated every dictionary details as the OOB m2m table.

@Salma Laskar 

so does your new m2m table have field pointing to "sn_vulc_result"?

share the screenshots and dictionary config

when you click Edit in related list what it shows and what you expect?

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

Salma Laskar
Tera Expert

Hi Ankur,

new m2m table has two fields - Task - references [task] table and Configuration Test Result - references [sn_vulc_result] table.

Now when I have pulled this custom m2m table on the Test Result table as a related list and I click on 'Edit' on the related list, the left slush bucket (collection) is expected to have all Tasks which we should be able to pull to the right bucket to develop the association between test result and tasks