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 even after placing Use Strict command

(0) ShareShare
ReportReport
Posted on by 56
Hello 

i am having troubles fixing this Javascript code, can u help me guys? I have added "use strict" under those function calls:

JS
 
****
function formatSICField(executionContext) {
    "use strict"; 
    if (executionContext && typeof executionContext.getFormContext === 'function') {
        var formContext = executionContext.getFormContext();
        if (formContext) {
            var sicAttribute = formContext.getAttribute("sic");
            if (sicAttribute) {
                var sicField = sicAttribute.getValue();
                if (sicField && sicField.length === 6) {
                    var formattedSIC = sicField.replace(/(\d{2})(\d{2})(\d{2})/, "$1.$2.$3");
                    sicAttribute.setValue(formattedSIC);
                }
            }
        }
    }
}
function validateSICField(executionContext) {
    "use strict"; 
    if (executionContext && typeof executionContext.getFormContext === 'function') {
        var formContext = executionContext.getFormContext();
        if (formContext) {
            var sicAttribute = formContext.getAttribute("sic");
            if (sicAttribute) {
                var sicField = sicAttribute.getValue();
                var regex = /^\d{2}\.\d{2}\.\d{2}$/;
                var sicControl = formContext.getControl("sic");
                if (sicField && !regex.test(sicField) && sicControl) {
                    sicControl.setNotification("Formato invalido. Si prega di usare il formato 00.00.00.");
                } else if (sicControl) {
                    sicControl.clearNotification();
                }
            }
        }
    }
}

****
 
I have the same question (0)
  • BluFin.S Profile Picture
    56 on at
    No one is willing to help :(

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 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard