- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2022 07:47 AM
Hi,
I am working on Before Query Business Rule.
I want to show the requested_for records to requested_for user who is logged in.
I have written the following code but its not working.I am only getting blank page.
Can u please look at it ?
(function ExecuteRule(current,previous)
{
if(gs.hasRole('myrole') && gs.getSession().isInteractive())
{
current.addQuery('requested_for','==',gs.getUserID());
}
})(current,previous);
I dont know why its not working.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2022 07:59 AM
Hello, please try as below (remove the '==')
(function ExecuteRule(current,previous){
if(gs.hasRole('myrole') && gs.getSession().isInteractive()){
current.addQuery('requested_for', gs.getUserID());
}
})(current,previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2022 07:59 AM
Hello, please try as below (remove the '==')
(function ExecuteRule(current,previous){
if(gs.hasRole('myrole') && gs.getSession().isInteractive()){
current.addQuery('requested_for', gs.getUserID());
}
})(current,previous);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2022 07:59 AM
Hello,
It should be single '=' not '=='
This worked for me
current.addQuery('requested_for','=',gs.getUserID());
Regards
Regards,
Musab
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2022 08:04 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2022 08:21 AM
Thank you so much for your answer.
Its working now.
I want the admin to view all the records.
I tried this but I am getting blank page for the admin role.What should I do for the admin.
(function ExecuteRule(current,previous){
if(gs.hasRole('admin') && gs.getSession().isInteractive()){
current.query();
}
})(current,previous);