Can I use extended operators with a conditions field?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-16-2016 03:25 PM
I've implemented a conditions field on one of my tables, and I'm trying to evaluate another table that meets the criteria set up in the conditions field:
gs.info("Querying " + scenario.reference_table + " for " + current.sys_id);
gs.info("Quering using criteria: " + scenario.criteria);
var entity = new GlideRecord(scenario.reference_table);
entity.addQuery("sys_id",current.sys_id);
entity.addEncodedQuery(scenario.criteria);
entity.query();
This is currently returning a criteria that looks like:
Quering using criteria: priority=1^EQ
and this is working as expected. however when I add the extended_operators attribute to my conditions field, then the criteria evaluation returns an error.
extended_operators=VALCHANGES;CHANGESFROM;CHANGESTO
I then update the criteria to use a 'CHANGESTO' and the following log is generated:
Quering using criteria: priorityCHANGESTO1^EQ
The following error is generated on the UI:
Based on this it would seem that the conditions field doesn't support this extended_operator, but I would like to have this confirmed.
Thanks
Jordan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-16-2016 08:01 PM
Hi Jordan,
You can not use "changes", "changes from" in your custom GlideRecord object. These are the functions of GlideElement class and available at the time of transaction/operation only.
Like we can use these functions in business rule.
Thanks,
Param
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-17-2016 09:02 AM
Thanks Param.
So my use case is to allow a user to save a predefined action when a specific criteria has been met on a record.
My users are currently asking for the ability to say when field x changes to value y, execute the action.
At this stage I am saving the criteria within an object, then when anything that extends from the Task table changes, I check the criteria against the record that has changed. If the change matches the criteria, I fire off the predefined action.
Can you recommend a different way that would achieve what I am trying to accomplish?
thanks
Jordan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-17-2016 10:29 AM
Hi Jordan,
I do not think you can use Extended Operators like ChangesTo in Encoded-queries or Glide Object. I will say make some entries like Field Name , OLD Value , New Value and then use it in your glide-record logic.
Thanks,
Rajeev Lochan
PS: Hit like, Helpful or Correct depending on the impact of the response
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-17-2016 11:36 AM
Hi Jordan,
I didn't get you exactly, but might be below line help you :
Best way to achieve this by business rule. Just apply the business rule on parent table. You can also use condition like current.sys_class_name=='child_table' to run this business rule in case of your specific table only.
Thanks,
Param