This page: https://developer.atlassian.com/platform/marketplace/listing-forge-apps/ describes ways to check the license status on the frontend, or in backend functions called by the frontend.
However, how do I check license status in modules which are backend-only? (e.g. Trigger, JQL Function, etc.) Can you get hold of the Context object somehow?
All the examples in the relevant Marketplace docs are front-end. I think this is in-line with common feature-flagging approaches where the functionality is gated as close to the user as possible. Can you say more about why you want to perform licensing checking on the back-end?
Yes, it concerns an app in development, in which JQL Functions and Triggers constitute the core functionality. Thus, even if all frontend parts (e.g. configuration interfaces) were disabled in the unlicensed state, the core functionality would still remain usable.
By the way, even if JQL functions and triggers were of secondary importance in an app, being able to disable them in the unlicensed state would be essential. E.g. if a trigger makes some changes to some tickets, and the user gets notified about those changes in an email, it is just suboptimal in terms of UX if the user then logs in to Jira just to find that the changes are not visible because the app in question is not licensed.
In my case, if there is an automation that keeps being triggered by certain events, but you cannot explicitly configure or switch it off on any other way than by buying a license or uninstalling the app, it also contributes to a bad UX. In my view, an unlicensed app should either not do anything at all, or work as a “limited edition”: either way, you need to have fine grained control over what happens in an unlicensed state in every single Forge module type in order to avoid a frustrating customer experience.
Did you find a way to check the license state in the back-end?
With regards to the JQL functions, unfortunately not. Triggers do receive a “context” object (see here: https://developer.atlassian.com/platform/forge/events-reference/product_events/), I need to check whether it includes any license information in the production environment.
Unfortunately, this context is definitely empty.
I have opened a feature request about this: [FRGE-1334] - Ecosystem Jira