web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Solution checker - Str...
Power Apps
Unanswered

Solution checker - Strict mode error appear even after placing Use Strict command

(0) ShareShare
ReportReport
Posted on by

Hi All,

 

I am stuck with an issue where I am trying to get a clean chit from solution checker and it keeps complaining of the Strict mode requirement and throws up error "Strict mode is a way to introduce better error-checking into your code. Code should run in strict mode wherever possible.".

 

I have added the Use Strict command both in the start of the file as well as the function start, but no luck. Can any one please advice what else I could be missing.

 

My code is as below:

 

 

 

 

 

"use strict";
if (typeof CM === "undefined")
{
 CM = {}
}

if (typeof CM.UI === "undefined")
{
 CM.UI = {}
}

if (typeof CM.UI.Adjustment === "undefined")
{
 CM.UI.Adjustment = {}
}

CM.UI.Adjustment.Grid = new function ()
{
 "use strict";
 this.openQuickCreateForm = function (SelectedEntityTypeName, PrimaryEntityTypeName, FirstPrimaryItemId, PrimaryControl, SelectedControl)
 {
 let selectedControl = SelectedControl;

 if (PrimaryEntityTypeName.toLowerCase() !== "nty_contract")
 {
 // Calling OOB command for opening quick create form TODO
 return;
 }

 let triggeredSubgrid = selectedControl.name.toLowerCase();
 let adhocFlag = false;
 switch (triggeredSubgrid)
 {
 case "subgrid_adjustmentsadhoc":
 adhocFlag = true;
 break;
 case "subgrid_adjustments": 
 break;
 default:
 // Calling command for opening quick create form
//TODO
 break;
 }
 
 let formOptions = {
 "entityName": SelectedEntityTypeName,
 "cmdBar": false,
 "createFromEntity": { entityType: PrimaryEntityTypeName, id: FirstPrimaryItemId },
 "navbar": "off",
 "windowPosition": "side",
 "useQuickCreateForm": true
 }

 let formParameters = {
 "avo_adhoc": adhocFlag
 }

 SA.Xrm.Navigation.openForm(formOptions, formParameters);
 }

 this.enableButtonOnSubgrid = function (SelectedControl)
 { 
 let applicableSubgrids = [
 "subgrid_adjustmentsadhoc",
 "subgrid_adjustments",
 "subgrid_mrs_scheduleadjustments"
 ]
 let controlName = SelectedControl.name.toLowerCase();
 return applicableSubgrids.includes(controlName.toLowerCase());
 }
}

 

 

 

 

 

I have the same question (0)
  • AhmedSalih Profile Picture
    6,678 Moderator on at

    Hello, @MajidM , you have to 'use strict' within every new function. But not at the top level. You missed to add "use strict" under this function call:

    this.enableButtonOnSubgrid = function (SelectedControl)
     { 

     

     

    if (typeof CM === "undefined")
    {
     CM = {}
    }
    
    if (typeof CM.UI === "undefined")
    {
     CM.UI = {}
    }
    
    if (typeof CM.UI.Adjustment === "undefined")
    {
     CM.UI.Adjustment = {}
    }
    
    CM.UI.Adjustment.Grid = new function ()
    {
     "use strict";
     this.openQuickCreateForm = function (SelectedEntityTypeName, PrimaryEntityTypeName, FirstPrimaryItemId, PrimaryControl, SelectedControl)
     {
     let selectedControl = SelectedControl;
    
     if (PrimaryEntityTypeName.toLowerCase() !== "nty_contract")
     {
     // Calling OOB command for opening quick create form TODO
     return;
     }
    
     let triggeredSubgrid = selectedControl.name.toLowerCase();
     let adhocFlag = false;
     switch (triggeredSubgrid)
     {
     case "subgrid_adjustmentsadhoc":
     adhocFlag = true;
     break;
     case "subgrid_adjustments": 
     break;
     default:
     // Calling command for opening quick create form
    //TODO
     break;
     }
     
     let formOptions = {
     "entityName": SelectedEntityTypeName,
     "cmdBar": false,
     "createFromEntity": { entityType: PrimaryEntityTypeName, id: FirstPrimaryItemId },
     "navbar": "off",
     "windowPosition": "side",
     "useQuickCreateForm": true
     }
    
     let formParameters = {
     "avo_adhoc": adhocFlag
     }
    
     SA.Xrm.Navigation.openForm(formOptions, formParameters);
     }
    
     this.enableButtonOnSubgrid = function (SelectedControl)
     { 
    "use strict"; 
     let applicableSubgrids = [
     "subgrid_adjustmentsadhoc",
     "subgrid_adjustments",
     "subgrid_mrs_scheduleadjustments"
     ]
     let controlName = SelectedControl.name.toLowerCase();
     return applicableSubgrids.includes(controlName.toLowerCase());
     }
    }

     

     

     

    Regards,
    Ahmed
    If my reply helped you, please give a 👍. And if it has solved your issue, please consider Accepting it as the Solution to help other members of the community find it more.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard