Entity property conditions on user entity not working for globalPage/backgroundScript (Confluence Forge)

Hi all,

I’m trying to use Entity Property Conditions in a Confluence Forge app across two modules - Global Page and Background Script. Per the Confluence display conditions docs, both modules support entity property conditions on the user entity.

My goal is to show the page in sidebar and run the background script only if the specified property exists on current user.

Minimal reproduction: GitHub - aljazomwf/forge-confluence-user-entity-property-issue: Repository that reproduces the issue where user entity property is not respected by display conditions. · GitHub

Here’s the relevant part of my manifest:

modules:
  confluence:globalPage:
    - key: settings-page-module
      resource: main
      render: native
      title: Settings Module
      route: settings-page
      resolver:
        function: backend-resolver
    - key: hello-world-page-module
      resource: main
      render: native
      title: Hello World Module
      route: hello-world-page
      resolver:
        function: backend-resolver
      displayConditions:
        and:
          isLoggedIn: true
          entityPropertyExists:
            entity: user
            propertyKey: testprop

  confluence:backgroundScript:
    - key: background-script-module
      resource: main
      render: native
      displayConditions:
        and:
          isLoggedIn: true
          entityPropertyExists:
            entity: user
            propertyKey: testprop

What I’m doing: The Settings page has a button that sets/deletes the testprop property for the currently logged-in user. After setting it and refreshing the page, I still don’t see the Hello World page in the sidebar, and the background script’s console.log never runs.

What I’ve already verified:

  • Both modules appear/run correctly when I remove the displayConditions block, so the modules themselves are fine - using only entityPropertyExists without the isLoggedIn also does not work
  • The property is actually set
  • I’ve tried both running the API calls with asApp and asUser but it makes not difference
  • Trying the functionality with different user accounts
  • Logging in/out of the Confluence
  • Try it in private browser mode

Questions:

  1. Are user entity property conditions actually supported for globalPage and backgroundScript, or is there a caveat I’m missing?
  2. Is there a caching/re-evaluation delay for user properties (i.e. do I need to do something to force the condition to re-evaluate)?
  3. Any config/permission I’m missing?

Thanks,
Aljaz

Hi @Aljaz,

I’ve had a brief look, it looks like a similar bug has been reported in the past around this display condition behaviour in Confluence Forge https://jira.atlassian.com/browse/CONFCLOUD-84518. I’ve left a comment on it linking to this post - I would recommend voting/watching the ticket as it helps our internal teams prioritise issues.

Unfortunately there is no reported workaround. Do you think the Forge storage entity properties could suit your use case in the meantime? https://developer.atlassian.com/platform/forge/storage-reference/entities/

Hey @JeanYap ,

Thanks for looking into this and for linking the Jira ticket. Good to know it’s a bug and not something on my end.

I did consider Forge Storage, but in that case I’d have to invoke a Forge function from the background script to read and verify the value every time it runs for example. I would like to avoid that since it isn’t very friendly at scale. User entity property display conditions seemed like the ideal solution for this use case.

Is there an ETA about resolution of the bug ticket?

Thanks & have a nice day,

Aljaz