Unable to conditionally display a module using app context property

Hello there,

I am unable to use app.properties to conditionally display jira:issueContext: the module is displayed regardless of the condition and I assume that my condition is always evaluated as true. The same condition works on the project level perfectly well.

Here’s an extract of my manifest.yml:

jira:issueContext:
    - key: x-y-game-async-mode
      resource: sessionless
      resolver:
        endpoint: connect-endpoint
      title: X
      label: Y
      icon: resource:sessionless;icon/x-logo.png
      displayConditions:
        and:
          appIsLicensed: true
          hasAppAccess: true
          jiraExpression: app.properties['x-conf']['tab-displayed'] == true

the same expression works just fine for the following conditions:

jira:issueContext:
    - key: x-y-game-async-mode
      resource: sessionless
      resolver:
        endpoint: connect-endpoint
      title: X
      label: Y
      icon: resource:sessionless;icon/x-logo.png
      displayConditions:
        and:
          appIsLicensed: true
          hasAppAccess: true
          jiraExpression: project.properties['x-conf']['tab-displayed'] == true

and what I want to achieve is:

jira:issueContext:
    - key: x-y-game-async-mode
      resource: sessionless
      resolver:
        endpoint: connect-endpoint
      title: X
      label: Y
      icon: resource:sessionless;icon/x-logo.png
      displayConditions:
        and:
          appIsLicensed: true
          hasAppAccess: true
          jiraExpression: app.properties['x-conf']['tab-displayed'] == true && project.properties['x-conf']['tab-displayed'] == true

As for debugging I am able to set the app property properly and I am able to verify that it works and can be changed using /rest/api/3/expression/evaluate endpoint.

Are you using Connect and Forge in a single App? Because Forge and Connect App Properties are different Storages, while they are accessed in the same way for display conditions.

So If you write these App Properties using the Connect REST API, they will not be available in a forge module / display condition

Thanks for the response - I am actually using Connect and Forge in a single app, but I am using /rest/forge/1/app/properties/ to set this particular property.

The Code seems to be fine, but the displayConditions are very tricky to debug (you are not able to see expression errors that are thrown) and sometimes are not returning the same result as the expression eval endpoint.

You may check the following:

  • is x-conf a property that may not exist? If so, you should add a optional chaining
  • If possible, add the Connect App property just to make sure that it’s not related
  • Sometimes it takes a few minutes for changes on the manifest to apply, so I would change the title/label of another module to be able to see when the changed are live