How to set dynamic filter in many to many relationship edit button
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2024 09:13 PM
I Have a requirement where i need to add a dynamic filter to a slash bucket related list edit button. Attached some screen shots for referance.
@Chuck Tomasi
@Community Alums
Kindly revert me if any assistance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2024 02:28 AM
Hi @Nishna,
first you need to make a copy of the global "Edit..." UI Action and change the table to your m2m table. In the script field, you'll find code similar to this. You'll want to add your query in line 5.
var uri = action.getGlideURI();
var path = uri.getFileFromPath();
uri.set('sysparm_m2m_ref', current.getTableName());
uri.set('sysparm_stack', 'no');
uri.set('sysparm_query', '');
action.setRedirectURL(uri.toString('sys_m2m_template.do'));
If you also want to hide the filter so users can't change it, you can add this.
uri.set('jvar_no_filter', 'true');
Best regards,
Rene
Please mark as correct/helpful if my answer helped you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2024 07:14 AM
I need this filter in Scoped application, M2M table is also present in scoped app.
Kindly let me know how can i approach this
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2024 01:33 PM
The "Edit..." UI Action you see on the related list is the global UI Action (present on all m2m tables) which needs to be overriden by creating a copy.
Go to System Definition > UI Action and add the following condition 1) Action name IS sysverb_edit_m2m 2) Table IS global. You should see one UI Action called "Edit...". Create a new UI Action and copy everything from the global one but change the table to your m2m table and add your query like I've explained in my previous reply.