Risk Register Fields -Risk Reporting - Calculated Measure or Calculated Member

Hi team,

I have been asked to better report on our risks within a Project, and I am struggling to achieve this in EAZYBI.
What we would like to achieve is a Report by Issue Type (Risk) where we can summarize the “Inherent Risk Level”, “Residual Risk Level” and “Enterprise Risk level”.

So far I have defined new Calculated Measures such as:

Residual Risk level
[Issue].CurrentMember.get(‘Residual Risk Level’),
MATCHES
{“Extreme”|“High”|“Medium”|“Low”},
AND
[Issue Type].[Risk]

The aim is to allow filtering on these fields associated to a Risk Issue Type.

Alternatively should this be a Calculated member in the Issue Dimension?

I have tried putting the above script in as a Calculated Member but get a message as follows:

“Do not use the other dimension Issue Type when defining a calculated member in Issue. Create complex calculations in Measures.”

Some other relevant information, I think:
The following do not turn up in custom fields for import:
Initial Consequence Rating
Initial Likelihood Rating
Inherent Risk Level
Residual Likelihood Rating
Residual Risk level
Realisation

However, the above fields are in the JIRA Risk Register Plug In as follows:
Initial Consequence Rating (customfield_22620)
Initial Likelihood Rating (customfield_22621)
Inherent Risk Level (customfield_22624)
Residual Likelihood Rating (customfield_22623)
Residual Risk level (customfield_22625)
Realisation (customfield_22627)

I am clearing doing something wrong, just unsure where I am getting it wrong.

Thanks in advance for any advice.

Cheers

Dave

Hi @David_Horne

If the fields are not showing up in the Custom fields section, please try to add them to the Advanced settings first, by using a code like this:

[jira.customfield_22620]
name = "Initial Consequence Rating"
data_type = "string"
dimension = true

Save the Advanced settings, and check the Custom fields section if the fields are now showing up and are available for selection.

When they are imported as dimensions and issue properties, you can use the Residual Risk level as a dimension in Rows and choose the Issue Type dimension in Pages to filter by “Risk” type issues.

Let me know if adding these fields to the Advanced settings allows you to import them!
​Best regards,
​Nauris

Hi @nauris.malitis , thanks for the response.

I have followed your advice above, but have needed to add a return statement.
So, for clarity I have done:
Additional Advanced Settings
[jira.customfield_22620]
name = “initial Consequence Rating”
data_type = “string”
dimension = true

Then I was asked to supply a return statement, so I wrote

Custom JavaScript code
return issue.field.customfield_22620

Then I save it.
So far so good.
Then when I import, I get the following error:
Execution of custom JavaScript code raised the following error:
TypeError: Cannot read property “customfield_22620” from undefined

Any further advice?

Regards

Dave

1 Like

Hi @David_Horne

By the looks of it, it looks like you’re defining a new calculated field in the import options.

What is necessary, however, is to add the previous code to the global Advanced settings:

Let me know if you successfully added the code or if you don’t have access to these settings!
​Best regards,
​Nauris

1 Like

Hi @nauris.malitis ,

Thanks for the clarification. I do not have those permissions.

Regards

Dave

Hi @David_Horne

Ok, got it!

What is the company behind the Risk Register app that you are using?
There are several apps in the marketplace, and I just want to make sure that I test the right one :slight_smile:

Also, are you on Jira Cloud or on Jira Server/Data center?

I’ll let you know of possible implementations once I test it out!

Thanks!
Nauris

Hi @nauris.malitis , we use the Risk Matrix macro from ProjectBalm.

Regards

David

Hi @David_Horne

Thanks for the details!

And are you using eazyBI for Jira Cloud (is your Jira URL ***.atlassian.net)?
Or are you using eazyBI for Jira Server/Data Center?

Thanks!
Nauris

We are using Jira Server/data Centre.

Dave

Hi @David_Horne

Just checked it out, and there’s no way to import the values from the import options without defining the fields in the global Advanced settings.

Please reach out to your Jira administrator with a request to add the following lines to the Advanced settings and save the settings. Once this is done, you’ll see all the fields available for import in the import options:

[jira.customfield_22620]
data_type = "string"
dimension = true

[jira.customfield_22621]
data_type = "string"
dimension = true

[jira.customfield_22624]
data_type = "string"
dimension = true

[jira.customfield_22623]
data_type = "string"
dimension = true

[jira.customfield_22625]
data_type = "string"
dimension = true

[jira.customfield_22627]
data_type = "string"
dimension = true

Note that this will correctly import these values:

If you wish to also import the “Medium” and “High” values visible on the color backgrounds, some additional data formatting will be necessary as these values are stored differently.

​Let me know if you have any additional questions on this!
​Best regards,
​Nauris

1 Like

Thanks @nauris.malitis ,

I’ll send this to our admin and let you know the outcome.

Thanks for your help thus far.

Cheers

Dave

Hi @nauris.malitis ,

Our admin has inserted those custom fields and they work.

What is the extra we need to do for this area?

Regards

David

Hi @David_Horne

To access these values, you first need to understand the structure of these fields.
​You can see this in the issue JSON file by using this URL:

​http:// Your Jira URL here .com/rest/api/latest/issue/D3-191

Replace the “Your Jira URL here .com” with the URL of your Jira instance and the “D3-191” with an example issue key.

The custom fields will have text values like you can see here:

They, unfortunately, don’t have a JSON structure, but we still can find the name value by using a regular expression.

So, the code, in my case, for the Inherent risk, would be like this:

[jira.customfield_16705]
data_type = "string"
dimension = true
javascript_code = '''
let fieldValue = issue.fields.customfield_16705
if (fieldValue) {
  // Regular expression to match the name value
  let nameRegex = /name='([^']+)'/;

  // Using the regex to find the match
  let match = fieldValue.match(nameRegex);

  // Extracting the value if a match is found
  let nameValue = match ? match[1] : null;

  if (nameValue) {
    issue.fields.customfield_16705 = nameValue;
  }
}
'''

If you previously already had imported this customfield_16705, then, after saving the Advanced settings, you will need to perform a double import to clear the old values and import new ones:

  1. Go to the “Source Data” tab, click “Edit” for your Jira source and open the “Custom fields” section. De-select the field from importing and run the import without this field selected (this will clear the old data and structure of the field).
  2. After the import finishes, again, select this field for import and run the import. This will import a fresh set of values for this field.

​Let me know if you have any additional questions on this!
​Best regards,
​Nauris

1 Like

Thanks for the response @nauris.malitis ,

Where does this code get written?

I have done it where I can in the Calculated Custom Fields, but I get a Missing ‘return’ message.

Is this where I write it, or do I need to send it to our admin and ask them to do it somewhere?

Thanks for the follow up.

Cheers

Dave

Hi @David_Horne

This should be done in the eazyBI Advanced settings: Advanced settings for custom fields

If you don’t have access to the Advanced settings, let me know, and I’ll adjust it for the new calculated field.

​Best regards,
​Nauris

1 Like

Hi @nauris.malitis ,

I don’t have those permissions, but I can do it in Calculated Custom Fields…

Thanks again for your assistance.

Regards

Dave

Hi @David_Horne

If you had this field previously declared in the Advanced settings with the 3 line parameters from one of my previous replies, then you should actually already see the custom field in the list (no need to declare a new one).

Click the “Edit” button for this custom field:

And use the following JS code in the settings like this:

let fieldValue = issue.fields.customfield_16705
if (fieldValue) {
  // Regular expression to match the name value
  let nameRegex = /name='([^']+)'/;

  // Using the regex to find the match
  let match = fieldValue.match(nameRegex);

  // Extracting the value if a match is found
  let nameValue = match ? match[1] : null;

  if (nameValue) {
    return nameValue;
  }
}

Let me know if this works as expected!
​Best regards,
​Nauris

1 Like

Hi @nauris.malitis ,

Thanks so much, it has worked perfectly.

Cheers

Dave

1 Like