License info or context in triggers

Is there any way to get license.active value in jira trigger?

A forge function, being triggered by a product event like Jira update-issue, will get the context as the 2nd param. This can be used for checking the license status as within the following sample:

export function isLicenseActive(context) {
    // Check for an environment variable that overrides the license state
    const override = process.env.LICENSE_OVERRIDE;

    if (typeof override !== 'undefined') {
        if (override.toLowerCase() === 'active') {
            return true;
        }
        if (override.toLowerCase() === 'inactive') {
            return false;
        }
    }
    return context && context.license && context.license.isActive;
}

export async function processUpdateEvent(event, contextPromise) {
  const context = await contextPromise;

   if (isLicenseActive(context) !== true) {
	console.log("This app is not licensed: all functionalities are disabled!");
	return false;
  }
  console.log("function triggered by event: " + JSON.stringify(event));
  return true;
}
3 Likes

Hello, Have you solved the problem? can I get the license in forge scheduledTrigger Active value? I urgently need to deal with this problem.