Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Answered

Powerapps solution checker use strict issue

(0) ShareShare
ReportReport
Posted on by 1,760

Hi Guys

I'm using 'use strict' in every function in a JavaScript file but the solution checker will still pick up a medium severity issue i.e. Use strict mode when possible. How do i go about making this go away? Or is this a known issue. 

  • Suggested answer
    Joe Crockett Profile Picture
    20 on at
    RE: Powerapps solution checker use strict issue

    I know this is an ancient question by the standard of this board, but I thought I'd share for the future: the solution checker warns you when you're not using "use strict" --- AND when you're using it incorrectly.

    I had thrown a bunch of "use script"s in there to make it go away -- and still failed. I used JSHint in VSCode, which highlighted my unnecessary ones, and when I removed the unnecessary ones, the "web use strict" warning went away.

  • Tiago Ruivo Profile Picture
    40 on at
    RE: Powerapps solution checker use strict issue

    I just tested that on the beginning of the script, and inside the function. Both failed. The error keeps poping. Any suggestions at this point?

    Thanks

  • Verified answer
    Johnny Yun Profile Picture
    455 on at
    RE: Powerapps solution checker use strict issue

    Hi Tia,
    This is one known issue.

    How do you enable strict mode?

    Simple. Toss this at the top of a program to enable it for the whole script:

    "use strict";

    Or place it within a function to turn on strict mode only within that context.

    function imStrict(){
      "use strict";
      // ... your code ...
    }

    ECMAScript 5 Strict Mode: https://johnresig.com/blog/ecmascript-5-strict-mode-json-and-more/
    Currently you have to 'use strict' within every new function  But not at top level.

    function imStrict(){
      "use strict";
      // ... your code ...
    }

    https://community.dynamics.com/crm/f/microsoft-dynamics-crm-forum/374113/why-does-solution-checker-not-recognize-use-strict-in-the-beginning-of-a-javascript-webresource
    If you still met the issue please raise one ticket for escalation. Appreciate.

    Following doc list the MS Best practice rules used by solution checker
    https://docs.microsoft.com/en-us/powerapps/maker/common-data-service/use-powerapps-checker#best-practice-rules-used-by-solution-checker
    https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode/Transitioning_to_strict_mode
    Strict mode is a way to introduce better error-checking into your code. Code should run in strict mode wherever possible. This is a JavaScript warning.
    Add use strict to the JavaScript file, this link explains it more detail
    According to this article it Strict mode helps :
    It catches some common coding bloopers, throwing exceptions.
    It prevents, or throws errors, when relatively “unsafe” actions are taken (such as gaining access to the global object).
    It disables features that are confusing or poorly thought out.
    Should you use single or double quotes e.g.
    ‘use strict’;
    or
    “use strict”;
    In JavaScript, it doesn’t matter if you use single or double quotes, here for more details
    To invoke use strict for the whole file, place it before any other JavaScript statements. It’s possible to apply use strict for specific functions.
    Reference Blog:https://crmbusiness.wordpress.com/2020/01/16/what-the-solution-checker-does-and-why-you-should-use-it/
    H
    ope above would hlep.

    Regards

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 294,467 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 233,066 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Product updates

Dynamics 365 release plans