- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-07-2024 04:46 AM
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):
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!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-09-2024 02:42 AM
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
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:
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
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
If Control is NOT Retired
So basically I:
- Modified OOTB BR to make my new Result Choice as passed (OOTB it was false)
- Deactivated OOTB Business Rule
- 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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-07-2024 05:30 AM
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!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-07-2024 05:39 AM
Hello Satishkumar,
that is exactly what I tried but did not work.
It either creates Issue for both choices, or does NOT create Issues at all.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-07-2024 10:19 AM
Use async Business rule on Insert
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-07-2024 12:48 PM - edited 08-07-2024 12:50 PM
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