
- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
on 03-08-2021 05:06 AM
If you have 3 tables:
- Table A
- Table B
- Table C
Table B has a reference to A and another to C.
If you want to relate records from table A to C, making B behave like a m2m, you need to override the Edit that shows on the RL with the action name 'sysverb_edit_o2m' (on table A)
The condition of the new Edit UI action will be:
(new GlideRecord(current.getTableName())).canWrite() && RP.isRelatedList() && !RP.getListControl().isOmitEditButton()
And the script will look like this:
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', '[field on table B that references table C]');
uri.set('sysparm_collection_related_file', '[table C name]');
action.setRedirectURL(uri.toString('sys_m2m_template.do'));
This way, when you click on Edit on the Related list for table B (from Table A form), table B will behave like a m2m table between A and C.
Please let me know if you have any comments,
David Neves
- 1,023 Views
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Thank you very much for sharing.
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Thank you
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
This helped a lot, thanks a ton! 😃
Also, can you share if there is any reference to understand the parameters used here?