Forge app: jira:issueContext module with jiraExpression in displayConditions not working with context variables

Hi,

I’m working on a Forge app which has a jira:issueContext module with a few displayConditions.

One of these conditions is a jiraExpression, which checks if an app property (which is an array of strings) contains the project id of the issue which the module is displayed on.

It works fine when I hardcode the issue project id, for example:

            entityPropertyExists:
              entity: app
              propertyKey: display-settings
              objectName: allowedProjectIds
            jiraExpression: "app.properties['display-settings']['allowedProjectIds'].includes('10013')"

It evaluates to true, but when I try to replace the hardcoded project id with the context variable:

            entityPropertyExists:
              entity: app
              propertyKey: display-settings
              objectName: allowedProjectIds
            jiraExpression: "app.properties['display-settings']['allowedProjectIds'].includes(issue.project.id)"

It doesn’t work.

Anybody has a clue of what I might be doing wrong here?

I figured this out, with Github Copilot help.

Since the values in allowedProjectIds are strings, the correct expression is:

jiraExpression: “app.properties[‘display-settings’][‘allowedProjectIds’]?.includes(‘’ + issue.project.id) || false”