# How to call the license method in forge scheduled triggers

**URL:** <https://community.developer.atlassian.com/t/how-to-call-the-license-method-in-forge-scheduled-triggers/63660>\
**Category:** Forge\
**Tags:** licensing, scheduled-triggers, confluence-cloud\
**Created:** [November 21, 2022, 3:18am UTC](https://community.developer.atlassian.com/t/how-to-call-the-license-method-in-forge-scheduled-triggers/63660 "2022-11-21T03:18:24Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![liumulin](https://avatars.discourse-cdn.com/v4/letter/l/6f9a4e/32.png) [@liumulin](https://community.developer.atlassian.com/u/liumulin)\
**Post date:** [November 21, 2022, 3:18am UTC](https://community.developer.atlassian.com/t/how-to-call-the-license-method-in-forge-scheduled-triggers/63660/1 "2022-11-21T03:18:24Z")

</div>

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.

```auto

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

```

---

<div class="post-metadata">

**Author:** ![clement\_garin](https://sea1.discourse-cdn.com/atlassiandeveloper/user_avatar/community.developer.atlassian.com/clement_garin/32/38126_2.png) [@clement\_garin](https://community.developer.atlassian.com/u/clement_garin)\
**Post date:** [November 21, 2022, 10:52am UTC](https://community.developer.atlassian.com/t/how-to-call-the-license-method-in-forge-scheduled-triggers/63660/2 "2022-11-21T10:52:36Z")

</div>

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](https://developer.atlassian.com/platform/marketplace/listing-forge-apps/):

> 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.

---

<div class="post-metadata">

**Author:** ![liumulin](https://avatars.discourse-cdn.com/v4/letter/l/6f9a4e/32.png) [@liumulin](https://community.developer.atlassian.com/u/liumulin)\
**Post date:** [November 23, 2022, 1:40am UTC](https://community.developer.atlassian.com/t/how-to-call-the-license-method-in-forge-scheduled-triggers/63660/3 "2022-11-23T01:40:07Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![JoshuaHwang](https://sea1.discourse-cdn.com/atlassiandeveloper/user_avatar/community.developer.atlassian.com/joshuahwang/32/44116_2.png) [@JoshuaHwang](https://community.developer.atlassian.com/u/JoshuaHwang)\
**Post date:** [November 23, 2022, 10:13pm UTC](https://community.developer.atlassian.com/t/how-to-call-the-license-method-in-forge-scheduled-triggers/63660/4 "2022-11-23T22:13:32Z")

</div>

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](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.

---

<div class="post-metadata">

**Author:** ![liumulin](https://avatars.discourse-cdn.com/v4/letter/l/6f9a4e/32.png) [@liumulin](https://community.developer.atlassian.com/u/liumulin)\
**Post date:** [November 24, 2022, 9:58am UTC](https://community.developer.atlassian.com/t/how-to-call-the-license-method-in-forge-scheduled-triggers/63660/5 "2022-11-24T09:58:57Z")

</div>

I see. Thank you.
