Skip to main content

Notifications

Microsoft Dynamics 365 | Integration, Dataverse...
Answered

Problem Adding a Web Resource

Posted on by 235

I am working through Mastering-Dynamics-365-customization-development/ 

When I add a web resource7382.PNG

with the script 

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); }

and then add this to the Contacts Main Form

4555.png

I get the following error on opening the form:

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 (https://ghdunn1.crm11.dynamics.com/uclient/scripts/app.js?v=1.3.177-1911.3:563:5034)

Can anyone suggest where i am going wrong?

Thanks

Gerald

  • ghdunn Profile Picture
    ghdunn 235 on at
    RE: Problem Adding a Web Resource

    Hi rthompson.

    I think those pictures zoom in if you click on them..

    I think I have an answer now from Henry...many thanks for your help.

    Gerald

  • Verified answer
    Henry J. Profile Picture
    Henry J. 5,237 on at
    RE: Problem Adding a Web Resource

    Hi Gerald,

    Please refer to the answer I have provided here: community.dynamics.com/.../999709

    Henry

  • rthompson Profile Picture
    rthompson 1,530 on at
    RE: Problem Adding a Web Resource

    Hi ghdunn,

    Would you please enlarge your screen shots and using the insert > insert code.

    That will help out a lot.

    Thanks

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!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

New! Quick response templatesâš¡

Save time with the new custom templates!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,064 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans