- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2014 06:15 AM
Hi Service now community
I've tried to filter a list of record with a business rule,
Below a piece of my code :
FiltrerTrade();
function FiltrerTrade()
{
gs.log("launch BS /////");
var cUser = gs.getUser();
if (cUser.isMemberOf('dab52fb36ff9e100089542750d3ee4b4') == true)
{
gs.log('member of Trade');
var grp = new GlideRecord('u_gtb_reclam');
grp.addEncodedQuery('assignment_group=dab52fb36ff9e100089542750d3ee4b4^ORu_first_assigment_group=dab52fb36ff9e100089542750d3ee4b4');
grp.query();
while (grp.next())
{
if (grp.assignment_group = 'dab52fb36ff9e100089542750d3ee4b4' || grp.u_first_assigment_group == 'dab52fb36ff9e100089542750d3ee4b4')
{
gs.log('can read ' + grp.number);
}
}
}
}
This BS work find and return what I want, like "member of Trade & can read NB0001", so That find the good record.
But now I try to filter my list and I don't know how to do, i've already try to return a filter, but doesn't work.
Actually after this BS, all of my record are shown, I just want to display NB001.
Thanks in advance for your answers !
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2014 06:22 AM
in the BR you have
WHEN: query true
table: u_gtb_reclam
you then add to the current query by scripting current.addQuery...
i.e.
var qc = current.addQuery('assignment_group','dab52fb36ff9e100089542750d3ee4b4').addOrCondition('u_first_assigment_group','dab52fb36ff9e100089542750d3ee4b4');
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2014 06:22 AM
in the BR you have
WHEN: query true
table: u_gtb_reclam
you then add to the current query by scripting current.addQuery...
i.e.
var qc = current.addQuery('assignment_group','dab52fb36ff9e100089542750d3ee4b4').addOrCondition('u_first_assigment_group','dab52fb36ff9e100089542750d3ee4b4');
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2014 06:32 AM
It works perfectly with
| return (current.addQuery('assignment_group','dab52fb36ff9e100089542750d3ee4b4').addOrCondition('u_first_assigment_group','dab52fb36ff9e100089542750d3ee4b')); |
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2014 08:46 AM
it works fine but only with equal value.
i.e : if I use '=', or 'CONTAINS' or 'LIKE' it works perfectly but if I use '!=' or 'DOES NOT CONTAINS' or 'NOT LIKE'
it fail...
Any idea ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2014 08:56 AM
if you remove the 's' from DOES NOT CONTAINS does it work 'DOES NOT CONTAIN'
