- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-22-2015 11:44 AM
I am attempting to do an achievements/gamification application that will allow an administrator-type to specify different Achievement records with a "Condition" field type. This way they can use drop downs similar to how they build list filters to say how achievements should be awarded, instead of having to write some Javascript for everything (since they will be managers, not necessarily coders).
So in my master business rule that runs the evaluation, I want to be able to say something like:
var ach - new GlideRecord('u_achievements');
//query all achievements here
while (ach.next()) {
if (current.matchCondition(ach.u_condition))
//do stuff
}
I know ach.u_condition will return an encoded query string, which I could use to query a list or something, but that doesn't really let me do this.
I could parse the query string myself and convert it into evaluatable lines of code, but obviously I don't want to reinvent the wheel if I don't have to. Has anyone managed to accomplish this?
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-22-2015 01:19 PM
GlideFilter class will be the key!
value = GlideFilter.checkRecord( current , ach.u_codition);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-22-2015 01:19 PM
GlideFilter class will be the key!
value = GlideFilter.checkRecord( current , ach.u_codition);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-22-2015 01:33 PM
That's exactly what I needed - must just not have used the right terms when I was searching. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-22-2015 01:47 PM
Believe me, it's really hidden, I found it one day dealing with SLA Condition Base ... I came there to rescue this snippet for you.