- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2017 06:23 AM
Hi,
Here's a scenario:
- A calculated true/false field on incident table with a simple code (Category empty😞
(function calculatedFieldValue(current) { return current.getValue('category') == '' || current.getValue('category') === null || current.getValue('category') == null; })(current);
- A list of incident with grouping on new field enabled:
- An xml view of INC0000048 from the list above shows correctly <u_category_empty>true</u_category_empty>
- A simple backgorund script shows 0 rows returned:
var test = new GlideRecord('incident'); test.addEncodedQuery('u_category_empty=true^u_category_empty=\'true\''); test.query(); gs.log(test.getRowCount());
Question: why my Category empty = true records are inside false results group? I am also unable to filter on either true or false on this field.
This happens on both Istanbul and Jakarta fresh developer instances.
See more of my content here.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-05-2017 12:59 PM
I think 'calculated value' is not a good choice, if you already have a lot of record. Even though the list view show's true or false, they might not actual be on the table.You need to save the records for the value to be written to the table. I suggest to run a BR on insert, so your new incidents would have the field value populated. For the existing ones use a Schedule job and set the value based on your criteria.
Darshak
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-05-2017 08:22 AM
Hi,
Can you explain, why do you have the query set up as, 'u_category_empty=\'true\'' ? What does this syntax accomplish?
Darshak
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-05-2017 08:44 AM
Hi Cezaty,
Please note if a check box is not chosen,or if 'none' is chosen in choice field with default as none, then for those values where there is no value selected => is considered as false value.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-05-2017 12:59 PM
I think 'calculated value' is not a good choice, if you already have a lot of record. Even though the list view show's true or false, they might not actual be on the table.You need to save the records for the value to be written to the table. I suggest to run a BR on insert, so your new incidents would have the field value populated. For the existing ones use a Schedule job and set the value based on your criteria.
Darshak
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-06-2017 02:06 AM