Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics 365 | Integration, Dataverse...
Answered

Web resource method does not exist

(0) ShareShare
ReportReport
Posted on by 235

I am working through exercises in 'Mastering Microsoft Dynamics 365 Customer Engagement' book by Deepesh Somani

I have created a web resource and then updated the properties of the Contacts form to include that resource. 

4604.PNG

6505.PNG

When opening the form I get 

Web resource method does not exist: progressIndicatorSession Id: 0533bec9-2936-48eb-9be7-74c59e5b0035Correlation Id: 7f893731-dc02-413c-bc02-c226fb06f35fTime: Sun Dec 22 2019 16:21:50 GMT+0000 (Greenwich Mean Time)

The log reads:

ReferenceError: Web resource method does not exist: progressIndicator
at jp.execute (ghdunn1.crm11.dynamics.com/.../app.js
at Ap._executeIndividualEvent (ghdunn1.crm11.dynamics.com/.../app.js
at Ap._executeEventHandler (ghdunn1.crm11.dynamics.com/.../app.js
at Object.execute (ghdunn1.crm11.dynamics.com/.../app.js
at v._executeSyncAction (ghdunn1.crm11.dynamics.com/.../app.js
at v._executeSync (ghdunn1.crm11.dynamics.com/.../app.js
at v.executeAction (ghdunn1.crm11.dynamics.com/.../app.js
at t.dispatch (ghdunn1.crm11.dynamics.com/.../app.js
at Object.dispatch (ghdunn1.crm11.dynamics.com/.../app.js
at Object.dispatch (https://ghdunn1.crm11.dynamics.com/uclient/scripts/app.js?v=1.3.177-1911.3:563:5034)

Any clues as to what i am missing?

  • ghdunn Profile Picture
    ghdunn 235 on at
    RE: Web resource method does not exist

    wow...this goes way beyond my current level of experience ...let me mull over what you have written.

    Henry...you have gone above and beyond..and on Christmas Eve.....let me raise a virtual glass to you....(and a real one should we ever meet!)

    thanks for your patience...I have learned a lot.

  • Verified answer
    Henry J. Profile Picture
    Henry J. 5,237 on at
    RE: Web resource method does not exist

    So this is better, this indicates that your function now triggers

    But there are issues with your code:

    1. I suspect that the address1_postalcode field is not present on your form ("Cannot read property 'addOnKeyPress' of null"), so you should add it to your form for your code to work.
      Note: it might look like the field is already present, because it's part of the "Address 1" field which is composite and because composite fields are not supported in Unified Interface, they are displayed as if each of the address composite field was added as a normal field to the form. In fact, composite fields have this system name on your form: address1_composite_compositionLinkControl_address1_postalcode
    2. Your code is probably not going to run in Unified Interface, because it uses a deprecated method that only works on the legacy web client: addOnKeyPress
      This is documented here: https://docs.microsoft.com/en-us/power-platform/important-changes-coming#some-client-apis-are-deprecated
      To check how your code behaves on the legacy web client, you can tweak your URL by removing the appid parameter, and by adding &forceUCI=0&forceClassic=1 to it
  • ghdunn Profile Picture
    ghdunn 235 on at
    RE: Web resource method does not exist

    Have done that now - (as a .js script??)

    So my error is now:

    Cannot read property 'addOnKeyPress' of null

    Session Id: 8edc5938-4298-4cb0-a5c8-fb623ac6f597

    Correlation Id: a07de2f0-a976-4c2e-ba56-4aa463c371c2

    Time: Tue Dec 24 2019 14:32:42 GMT+0000 (Greenwich Mean Time)

    TypeError: Cannot read property 'addOnKeyPress' of null

       at suggestZipCodes (ghdunn1.crm11.dynamics.com/.../new_zipCodeAutoComplete:36:45)

       at jp.executeFunction (ghdunn1.crm11.dynamics.com/.../app.js

       at jp.execute (ghdunn1.crm11.dynamics.com/.../app.js

       at Ap._executeIndividualEvent (ghdunn1.crm11.dynamics.com/.../app.js

       at Ap._executeEventHandler (ghdunn1.crm11.dynamics.com/.../app.js

       at Object.execute (ghdunn1.crm11.dynamics.com/.../app.js

       at v._executeSyncAction (ghdunn1.crm11.dynamics.com/.../app.js

       at v._executeSync (ghdunn1.crm11.dynamics.com/.../app.js

       at v.executeAction (ghdunn1.crm11.dynamics.com/.../app.js

       at t.dispatch (ghdunn1.crm11.dynamics.com/.../app.js

  • Suggested answer
    Henry J. Profile Picture
    Henry J. 5,237 on at
    RE: Web resource method does not exist

    No I meant upload your JavaScript file (.js) in your "new_zipCodeAutoComplete" web resource, because there might be an issue with it if you used the Text Editor option.

    Basically the way you configured your properties, the "new_zipCodeAutoComplete" JavaScript web resource should contain a suggestZipCodes function, and the error message says it's not the case.

  • ghdunn Profile Picture
    ghdunn 235 on at
    RE: Web resource method does not exist

    ahh...a different error now: 

    Cannot read property 'addOnKeyPress' of nullSession Id: fd09323d-1a73-4bb1-88f0-1d6a5b4f32b9Correlation Id: 35a0f05d-9c43-4ca9-a11a-1585dd15c72eTime: Tue Dec 24 2019 13:55:31 GMT 0000 (Greenwich Mean Time)

    When you say 'Can you update the web resource by uploading the JavaScript file you have saved using Visual Studio Code?'

    ...do you mean upload to here?  

     

    function suggestZipCodes() {
      // defined possible ZipCode
      ZipCodes = [
      { name: '94102' },
      { name: '94103' },
      { name: '94104' },
      { name: '94105' },
      { name: '94107' },
      { name: '94108' }];
      var OnZipCodekeyPress = function (fld) {
      var ZipCodetxt = Xrm.Page.getControl("address1_postalcode").getValue();
      resultSet = {
      results: new Array(),
      commands: {
      id: "ZipCodecmd",
      label: "Search in Bing",
      action: function () {
      window.open(" http:// bing.com");
      // Open Bing URL
      } } };
      var ZipCodetxtLowerCase = ZipCodetxt.toLowerCase();
      for (i = 0; i < ZipCodes.length; i  ) {
      if (ZipCodetxtLowerCase === ZipCodes[i].name.substring(0, ZipCodetxtLowerCase.length).toLowerCase()) {
      resultSet.results.push({
      id: i,
      fields: [ZipCodes[ i]. name]
      });
      }
      if (resultSet.results.length >= 10) {break;} }
      if (resultSet.results.length > 0) {fld.getEventSource().showAutoComplete( resultSet);
      // Show Auto Complete 
      } 
      else { fld.getEventSource().hideAutoComplete();
      // Hide Auto Complete
      }};
      Xrm.Page.getControl("address1_postalcode").addOnKeyPress(OnZipCodekeyPress);
      }

  • Suggested answer
    Henry J. Profile Picture
    Henry J. 5,237 on at
    RE: Web resource method does not exist

    Your properties look correct.

    From the error message "ReferenceError: Web resource method does not exist: suggestZipCodes", it looks like there is a problem in the JavaScript in new_zipCodeAutoComplete web resource, the suggestZipCodes function isn't found.

    Can you update the web resource by uploading the JavaScript file you have saved using Visual Studio Code?

    Also, can you make sure that you do CTRL + F5 on the form when you do new tests?

  • ghdunn Profile Picture
    ghdunn 235 on at
    RE: Web resource method does not exist

    I have saved/published the Web Resource.

    Updated the Form Properties.

    Saved/published the form.

    When you say 'suggestZipCodes' is loaded on the form,' is there anything  i need to do beyond updating the properties?

    5.PNG

  • Suggested answer
    Henry J. Profile Picture
    Henry J. 5,237 on at
    RE: Web resource method does not exist

    It looks like it's the same error as before, but this time your code looks OK (you might want to fix the "i + +" to "i++").

    Have you made sure that the JavaScript web resource that contains the suggestZipCodes function is loaded on the form, looks like it isn't the case.

    Have you published your customizations?

    An updated screenshot of your Form Properties could help.

  • ghdunn Profile Picture
    ghdunn 235 on at
    RE: Web resource method does not exist

    Henry,

    Having taken your advice I am now using Visual Studio Code and I got one the previous script working, however I am still not very far up the curve.  Could I push you for a little more help?

    I have entered the following into Visual Studio Code and it seemed to look OK:

    function suggestZipCodes() {

    // defined possible ZipCode

    ZipCodes = [

    { name: '94102' },

    { name: '94103' },

    { name: '94104' },

    { name: '94105' },

    { name: '94107' },

    { name: '94108' }];

    var OnZipCodekeyPress = function (fld) {

    var ZipCodetxt = Xrm.Page.getControl("address1_postalcode").getValue();

    resultSet = {

    results: new Array(),

    commands: {

    id: "ZipCodecmd",

    label: "Search in Bing",

    action: function () {

    window.open(" http:// bing.com");

    // Open Bing URL

    } } };

    var ZipCodetxtLowerCase = ZipCodetxt.toLowerCase();

    for (i = 0; i < ZipCodes.length; i + +) {

    if (ZipCodetxtLowerCase === ZipCodes[i]. name.substring(0, ZipCodetxtLowerCase.length).toLowerCase()) {

    resultSet.results.push({

    id: i,

    fields: [ZipCodes[ i]. name]

    });

    }

     if (resultSet.results.length >= 10) {

          break;} }

           if (resultSet.results.length > 0) {

                fld.getEventSource().showAutoComplete( resultSet);// Show Auto Complete

               }

                 else {

                   fld.getEventSource().hideAutoComplete();

                   // Hide Auto Complete

               }

               }; Xrm.Page.getControl("address1_postalcode").addOnKeyPress(OnZipCodekeyPress);

               }

    However, when i create that as a web resource, and add that to the form, I get a similar error to before:

    Web resource method does not exist: suggestZipCodes

    Session Id: 646fc911-3b68-4864-9fb4-9178c192fbeb

    Correlation Id: b3d1e55c-66ac-41c9-ab17-25146f76c58f

    Time: Tue Dec 24 2019 12:02:57 GMT+0000 (Greenwich Mean Time)

    Log:

    ReferenceError: Web resource method does not exist: suggestZipCodes

       at jp.execute (ghdunn1.crm11.dynamics.com/.../app.js

       at Ap._executeIndividualEvent (ghdunn1.crm11.dynamics.com/.../app.js

       at Ap._executeEventHandler (ghdunn1.crm11.dynamics.com/.../app.js

       at Object.execute (ghdunn1.crm11.dynamics.com/.../app.js

       at v._executeSyncAction (ghdunn1.crm11.dynamics.com/.../app.js

       at v._executeSync (ghdunn1.crm11.dynamics.com/.../app.js

       at v.executeAction (ghdunn1.crm11.dynamics.com/.../app.js

       at t.dispatch (ghdunn1.crm11.dynamics.com/.../app.js

       at Object.dispatch (ghdunn1.crm11.dynamics.com/.../app.js

       at Object.dispatch (ghdunn1.crm11.dynamics.com/.../app.js

    Any clues?

  • Verified answer
    Henry J. Profile Picture
    Henry J. 5,237 on at
    RE: Web resource method does not exist

    Hi,

    This issue isn't really related to the Unified Interface, but from the error message "ReferenceError: Web resource method does not exist: progressIndicator", I would check the JavaScript stored in your web resource.

    It looks like it is missing the progressIndicator function, or it is maybe improperly written - do you write your code with with Visual Studio, Visual Studio Code or similar to check for errors?

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,391 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,445 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans