Join us Dec. 16 for The Community Hour, our first global virtual User Group event!

No Notes Since Creation: Open tasks older than 2 days with no work notes or comments.

poojanpatel
Giga Contributor

Is there a way to create score card for No Notes Since Creation: Open tasks older than 2 days with no work notes or comments in catalog task. 

4 REPLIES 4

TharaS657398130
Tera Guru

Hello

Use Platform Analytics

One simple workaround would be to add a true/false field (for example, Has Notes) to the Catalog Task table. We can then create a Business Rule to update this field to true whenever a comment or work note is added.

 

Once that's in place, we can create an Indicator Source to identify active Catalog Tasks that were created more than two days ago and still have no notes. 

 

If satisfied, give helpful & mark as solution

Thankyou!

HasanM
Kilo Sage

Hi @poojanpatel ,

The best approach is a flag field on Catalog Task plus a Platform Analytics indicator. Work notes and comments are stored in sys_journal_field, not on sc_task, so you can't filter for "no notes" directly.

  1. Add a True/False field to sc_task, for example u_has_notes, defaulting to false.
  2. Create a before insert/update Business Rule on sc_task with the condition current.work_notes.changes() || current.comments.changes(), and the script current.u_has_notes = true;
  3. Run a one-off fix script to backfill existing open tasks that already have notes in sys_journal_field. Otherwise they will all show as "no notes".
  4. Create an indicator source on sc_task with these conditions: Active is true, Created on or before 2 days ago, u_has_notes is false.
  5. Create a daily Count indicator, add breakdowns such as Assignment group, and add it to your scorecard.

This avoids querying the journal table on every collection, so it stays fast as your data grows. If you only need a current count rather than a trend, a Single Score report with the same conditions is enough.

Please test in sub-production first.

If this helped, please mark it as Helpful and Accept as Solution so others can find it.

Thanks!

can you show one example ?

Hi @poojanpatel ,

Here's a worked example.

  1. Field
    Table: Catalog Task [sc_task]
    Type: True/False
    Label: Has Notes
    Name: u_has_notes
    Default: false

  2. Business Rule
    Name: Set Has Notes on sc_task
    Table: sc_task
    When: before, Insert and Update
    Advanced: ticked
    Condition: current.work_notes.changes() || current.comments.changes()
    Script:

(function executeRule(current, previous) {
current.u_has_notes = true;
})(current, previous);

  1. Fix script (one-off, to backfill existing open tasks)

var task = new GlideRecord('sc_task');
task.addActiveQuery();
task.addQuery('u_has_notes', false);
task.query();
while (task.next()) {
var jf = new GlideRecord('sys_journal_field');
jf.addQuery('name', 'sc_task');
jf.addQuery('element_id', task.getUniqueValue());
jf.addQuery('element', 'IN', 'work_notes,comments');
jf.setLimit(1);
jf.query();
if (jf.hasNext()) {
task.u_has_notes = true;
task.setWorkflow(false);
task.autoSysFields(false);
task.update();
}
}

  1. Indicator source
    Name: Catalog Tasks - No Notes Since Creation
    Facts table: Catalog Task [sc_task]
    Conditions:
    Active is true
    AND Created relative before 2 Days ago
    AND Has Notes is false

  2. Indicator
    Name: No Notes Since Creation
    Type: Automated
    Indicator source: Catalog Tasks - No Notes Since Creation
    Aggregate: Count
    Frequency: Daily
    Direction: Minimise
    Add breakdowns such as Assignment group, then run the data collection job and add the indicator to your scorecard or dashboard.

If you only need the current count, a Single Score report on sc_task with the same three conditions works without Platform Analytics.

Please test in sub-production first.

Hope this helps. If it does, please mark it as helpful or accept it as the solution.