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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Answered

Web Resource method does not exist

(1) ShareShare
ReportReport
Posted on by 5

I am getting the below error: 

 
 
I have the same question (0)
  • Verified answer
    Joseph Melillo Profile Picture
    125 on at
    It seems your function name is incorrect.
    The function name in your script file does not match the one configured in the form event handler.
     
     
    Also you can use the following function that is improved version:
     
    function checkForDuplicates(executionContext) {
        var formContext = executionContext.getFormContext();
        formContext.data.refresh(false).then(function success() {
            var duplicateFlag = formContext.getAttribute("eem_ContractDupeFlag3").getValue();
            if (duplicateFlag === true || duplicateFlag === 1) {
                var alertStrings = {
                    confirmButtonLabel: "OK",
                    text: "A record with the same combination of fields already exists.",
                    title: "Duplicate Warning"
                };
    
                var alertOptions = { height: 120, width: 260 };
                Xrm.Navigation.openAlertDialog(alertStrings, alertOptions).then(
                    function success() {
                        console.log("Alert closed");
                    },
                    function error() {
                        console.error("Error showing alert dialog");
                    }
                );
            }
        }, function error(err) {
            console.error("Error refreshing data: ", err.message);
        });
    }
    
     
  • RJ-17121113-0 Profile Picture
    5 on at
    Thanks Joseph! I tried this & got a 0x83215603 error, so added a setTimeout error (amended code below) that runs - but I get no dialogue pop up even though the criteria is met, if you can help that would be great as I am stumped. TIA
     
    function checkForDuplicates(executionContext) {
        var formContext = executionContext.getFormContext();
        formContext.data.refresh(false).then(function success() {
            var duplicateFlag = formContext.getAttribute("eem_ContractDupeFlag3").getValue();
            if (duplicateFlag === true || duplicateFlag === 1) {
                var alertStrings = {
                    confirmButtonLabel: "OK",
                    text: "A record with the same combination of fields already exists.",
                    title: "Duplicate Warning"
                };
                var alertOptions = { height: 120, width: 260 };
                
                // Adding a delay using setTimeout
                setTimeout(function() {
                    Xrm.Navigation.openAlertDialog(alertStrings, alertOptions).then(
                        function success() {
                            console.log("Alert closed");
                        },
                        function error() {
                            console.error("Error showing alert dialog");
                        }
                    );
                }, 3000); // 3000ms = 3 second delay
            }
        }, function error(err) {
            console.error("Error refreshing data: ", err.message);
        });
    }
     
    Rowena
     
     
  • RJ-17121113-0 Profile Picture
    5 on at
    Hi, just realised my field name didn't have capital letters in - revised this and it is working beautifully :)
     
    Thank you so much for your help :)
     
     
  • Verified answer
    Amit Katariya007 Profile Picture
    10,409 Super User 2025 Season 2 on at
    In Event handles you have to mention function name rather than the file name...
     
    So function name will be "checkForDuplicates"

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 70 Super User 2025 Season 2

#2
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 43 Most Valuable Professional

#3
Daniyal Khaleel Profile Picture

Daniyal Khaleel 32 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans