How to call the license method in forge scheduled triggers

I ran into a problem. can I get the license in forge scheduledTrigger Active value ? However, I refer to the following methods in scheduled trggers. The result of context is undefined. What causes this? I need a solution.


const getLicense = async (context) => {
    return context.license && context.license.isActive;
}

Hey,

In which environment is running your trigger ? Because, in development and staging env, the license attribute is always undefined, as stated in the documentation:

You will most likely need to test that your app behaves as expected when it is both licensed and unlicensed. However, context.license is undefined when your app is deployed to development and staging.

On the same documentation page, you will find a way to test your license state in theses both env.

Hi, what if it is in the production environment? And my product has been approved by Atlassian, can I get the license value?

Hi

The license value is only present for paid apps. If you have a free app on the marketplace this value will be undefined.

https://developer.atlassian.com/platform/forge/ui-kit-hooks-reference/#returns-3

For free apps, apps not listed on the Atlassian Marketplace, and apps in development and staging environments, license is undefined.

Let me know if you’re still facing issues.

I see. Thank you.