How do you evaluate the condition_string type field?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2017 03:15 PM
I currently have a config type form and on this form I have created a condition string field that I wish to evaluate in a Business Rule for a different form.
The behavior would be very similar to a Business Rules condition field.
ie. Condition = gs.hasRoles('admin')
I have tried both GlideFilter and GlideScopedEvaluator, but neither seem to be correct.
I have also tried bringing the condition string that i am trying to evaluate right into my Business Rules Condition field:
ie. Condition = current.u_config.getRefRecord().getValue('u_conditions')
Ultimately, I am trying to put the condition of the BR as a configuration
So the following condition should work:
the same as:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2017 03:38 PM
Hi Michael,
You can use the GlideFilter to evaluate the condition builder field against a record. Condition builder field stores the condition in ecodedQuery format.
Let say recGR is the record where the condition string filed(u_condition) is placed. Then, do the following to evaluate it against your current record in BR condition:
GlideFilter.checkRecord(current, recGR.u_condition))
Hope this help !!!
Regards,
Rahul Jain

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2017 03:53 PM
Hi Rahul,
Thanks for the response.
I did look into this, however I am trying to evaluate things like the current user, his roles or groups and potentially other conditions against the current record.
Regards,
Mike
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-20-2019 06:32 AM
I need to have a condition that will check to see what view the form is opened in
as opposed to checking for a value in a field on the form or in the db.
Is there a way to do this?
I need this because I want to open a form with a different process flow formatter depending upon what view the form is opened in.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2018 06:14 PM
Just pass the condition string field through an anonymous function.
if (!new Function('return '+ condition)()) {
// failed condition
}
If your condition string needs to evaluate 'current', just declare 'current' within the scope of the script, if it hasn't already.
var current = gr;
if (!new Function('return '+ condition)()) {
// failed condition
}
Note: This will not work for the field type "conditions".