Forum Discussion

3 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Thanks. I know how to work with Postman, but I want to know another thing.
    I use licenseManager to get license data (plans, isLicenseUnsupportedEnv, isLicenseInfoAvailable) from powerBI to know if I have to show a watermark (watermark to buy a license).

    Example:
    options.host.licenseManager.getAvailableServicePlans().then((result: LicenseInfoResult) => { ... }


    So, the question is “How I can test the license plans before publishing the app?”
    How can I test instructions from this page? (https://learn.microsoft.com/en-gb/power-bi/developer/visuals/licensing-api)

    I want to test cases if I have a plan with a license key or if I have a trial period or if I don’t have a license. How can I test these cases?

  • Anonymous's avatar
    Anonymous
    Not applicable

    My code:

    constructor(options: VisualConstructorOptions) {
    this.host = options.host
    this.licenseManager = options.host.licenseManager

    this.licenseManager.getAvailableServicePlans().then((result) => {
    this.isPowerBILicense = !!(
    result.plans &&
    result.plans.length &&
    result.plans.some(
    (plan) =>
    PAID_PLANS.includes(plan.spIdentifier) &&
    (plan.state === powerbi.ServicePlanState.Active ||
    plan.state === powerbi.ServicePlanState.Warning),
    )
    )
    })
    }

    Now, I am in developer mode and I can't get real data, because the visual is not published.
    How can I test the license?