Auto add filter when query by business rule
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-06-2024 02:16 AM
I have a problem, I have a "u_demo_data" table and it has "u_import" column. I tried to use the business rule that auto-add condition "u_import=false" when the url has "sysparm_ignore_import=false". I tried the coding below in the business rule:
var isImported = gs.action.getGlideURI().getMap().get('sysparm_ignore_import");
if(isImported == 'true') {
current.addQuery('u_import', false);
}
It runs when I first open the screen. But it's not correctly, when I used the filter in the screen. I don't want to the fix_query.
What's the problem? I don't have a solution for this problem. Could you help me, please?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-06-2024 04:09 AM
so are you saying different filter should be applied when user navigates to the table from different place?
From which all places user will be navigating? why not form URL and give sysparm_query and user will be taken to the table with correct filter getting applied
Alternatively did you try to use the same script in table level READ ACL
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-06-2024 05:40 AM
@Ankur Bawiskar For security reasons, I don't want the user to know the query filter. So I want to hide the query filter. And I just want it to run on some screens.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-06-2024 05:43 AM
then try to use advanced script in your table level READ ACL
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader