Indicator Task Result - new choice and GRC Issue creation

Mira1992
Kilo Sage

Hello community,

I have a requirement from a customer to create a new choice for the Result field on the Indicator Task table.
I created a new choice on the sys_choice table so now I have these three choices (they also wanted to change the label):

Mira1992_0-1723030491299.png

And my Issue is:

When a Result of the Indicator Task is "Non Compliant" (failed), an Issue is created on the related Control. This is OOTB and fine for me.

But when a Result is Not Applicable, Issue is created as well. And I don't want that.
I know there is a BR "Create issue when result fails" but adjusting this BR did not help for me.

Can anyone help me with this?
When an Indicator Task is closed with my new choice, the Indicator Result [sn_grc_indicator_result ] is false so I believe I only need to find out how to set the value of the Indicator Result to true if the Indicator Task result is Not Applicable...

Would any of you know how to achieve this? Or at least hot to stop creating Issues for this Result?
Thanks a lot for any help!

1 ACCEPTED SOLUTION

Mira1992
Kilo Sage

Here is what solved my problem with the new Indicator Task Result value:

1) I modified the OOTB BR: Indicator task close

This makes my new Indicator Task Result Choice as "Passed = True" on the Indicator Result

Mira1992_7-1723196134858.png

 

2) I deactivated the BR: Update control compliant (Application: GRC: Policy and Compliance Management)
3) Instead of this BR I created a new Flow: Update control Compliant or Not Applicable

  • Table: sn_grc_indicator_result
  • Trigger:
    • Created or Updated
    • Result changes to true
  • Actions:
    Mira1992_0-1723195364330.png

    Look Up Records tries to find Issues in the [sn_grc_issues] table on where Control/Risk is the same as the Control on the Indicator Result -> Indicator -> Control/Risk and State of the Issue is not Closed

    Mira1992_1-1723195669759.png

    Look Up Record finds the Indicator Task on the [sn_grc_indicator_task] table where the Sys ID is the same as the Sys ID of the Indicator Task on the Indicator Result -> Indicator Task

    Mira1992_2-1723195844539.png
    If Control is NOT Retired
  • Mira1992_3-1723195903264.pngMira1992_4-1723195931746.pngMira1992_5-1723196011705.png

     

    Mira1992_6-1723196039839.png

So basically I:

  1. Modified OOTB BR to make my new Result Choice as passed (OOTB it was false)
  2. Deactivated OOTB Business Rule
  3. Recreated this BR as a Flow and added my conditions and actions

I really hope this will help someone with the Requirement to add a new Choice for the Result on the Indicator Task table

View solution in original post

6 REPLIES 6

Satishkumar B
Giga Sage
Giga Sage

Hi @Mira1992 

Modify the existing Business Rule that calls the Script Include to override creation of issue. Adjust the BR to add a condition that excludes the “Not Applicable” result to prevent issue creation for this specific result.

 

please mark it helpful 👍 and accept solution if it helps you!!

Hello Satishkumar,
that is exactly what I tried but did not work.

Mira1992_0-1723034316477.png

Mira1992_1-1723034343974.png

It either creates Issue for both choices, or does NOT create Issues at all.




@Mira1992 

Use async Business rule on Insert

(function executeRule(current, previous /*null when async*/) {    
    // Create a GlideRecord object for the sn_grc_indicator_task table
    var indicatorTaskGR = newGlideRecord('sn_grc_indicator_task');
   
    // Query the record referenced by current.indicator_task
    if (indicatorTaskGR.get(current.indicator_task)) {
        gs.info("MN - Fetched Indicator Task record: " + indicatorTaskGR.sys_id);
       
        // Log the actual result field value
        var resultValue = indicatorTaskGR.getValue('result');
        gs.info("MN - Indicator Task Result Value: " + resultValue);
       
        // Check if the result field is populated
        if (resultValue) {            
            // Check if the result is "failed"
            if (resultValue.trim() == "failed") {
                gs.info("MN - Indicator Task Result is 'failed'. Creating or updating issue for record: " + current.sys_id);
                newsn_grc.IssueUtils().updateOrCreateIndicatorIssue(current);
            } else {
                gs.info("MN - Indicator Task Result is not 'failed'. No action taken.");
            }
        } else {
            gs.info("MN - Indicator Task Result is not populated yet.");
        }
    } else {
        gs.info("MN - Could not find Indicator Task record for current.indicator_task: " + current.indicator_task);
    }
})(current, previous);
 
please mark my response as helpful and accept the solution if it helps
 

I ended up deactivating the OOTB Create issue when result fails BR
And creating a new BR 
table: sn_grc_indicator_result
When: async
on Insert

Script:

(function executeRule(current, previous /*null when async*/) {
// Create a GlideRecord object for the sn_grc_indicator_task table
var indicatorTaskGR = new GlideRecord('sn_grc_indicator_task');

// Query the record referenced by current.indicator_task
if (indicatorTaskGR.get(current.indicator_task)) {
gs.info("Fetched Indicator Task record: " + indicatorTaskGR.sys_id);

// Log the actual result field value
var resultValue = indicatorTaskGR.getValue('result');
gs.info("Indicator Task Result Value: " + resultValue);

// Check if the result field is populated
if (resultValue) {
// Check if the result is "failed"
if (resultValue.trim() == "failed") {
gs.info("Indicator Task Result is 'failed'. Creating or updating issue for record: " + current.sys_id);
new sn_grc.IssueUtils().updateOrCreateIndicatorIssue(current);
} else {
gs.info("Indicator Task Result is not 'failed'. No action taken.");
}
} else {
gs.info("Indicator Task Result is not populated yet.");
}
} else {
gs.info("Could not find Indicator Task record for current.indicator_task: " + current.indicator_task);
}
})(current, previous);


I'm not entirely sure about this solution, but it worked. However, I would still appreciate any suggestions for a better one