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 :
Microsoft Dynamics CRM (Archived)

Script Error

(0) ShareShare
ReportReport
Posted on by 1,799

Hi, 

New to / attempting to learn JavaScript and I've added some code to the OnChange of the Phone Field.

function warningOnChange()

{ Xrm.Page.ui.setFormNotification("Please ensure the value entered in the Phone Field is correct.", "WARNING", "1");

I'm getting a script error when the Account Form loads. I've tried enabling legacy Form Rendering but this doesn't work either. I assume I'm doing something wrong. As you can see, the code appears to have worked, as the notification is appearing in the background: 

Screen-Shot-2016_2D00_08_2D00_08-at-14.12.24.png

*This post is locked for comments

I have the same question (0)
  • Shiva.B Profile Picture
    150 on at

    Hai, I just verified you script its working for me, once recheck that you have added correct web resource

     and function name

  • Karsten Wirl Profile Picture
    4,477 on at

    Hello.

    Please post the error log here. Thanks.

  • Suggested answer
    Community Member Profile Picture
    on at

    eval problems are almost always caused by typos in function call or forgetting to add the javascript library to the form. Please check that the javascript file has been added to the account main form, and that it's using the correct file and function name.

  • JDMCRM Profile Picture
    1,799 on at

    Thanks for all the responses. I still can't get it to work. I'll send some screenshots outlining how I've got it set-up. Maybe I'm missing something.

    Screen-Shot-2016_2D00_08_2D00_08-at-16.07.28.png

    Screen-Shot-2016_2D00_08_2D00_08-at-16.07.09.png

    Screen-Shot-2016_2D00_08_2D00_08-at-16.06.57.png

    And looking from the Field Properties, rather than the Form Properties view: 

    Screen-Shot-2016_2D00_08_2D00_08-at-16.07.28.png

  • JDMCRM Profile Picture
    1,799 on at

    Error Log:

    TypeError: Cannot read property 'Initialize' of undefined

       at eval (eval at RunHandlerInternal (mod387996.crm.dynamics.com/.../ClientApiWrapper.aspx), <anonymous>:1:26)

       at RunHandlerInternal (mod387996.crm.dynamics.com/.../ClientApiWrapper.aspx)

       at RunHandlers (mod387996.crm.dynamics.com/.../ClientApiWrapper.aspx)

       at ExecuteHandler (mod387996.crm.dynamics.com/.../ClientApiWrapper.aspx)

       at $C7_1 (mod387996.crm.dynamics.com/.../JsProvider.ashx;ids=1223231347-405283869:8908:91)

       at executeHandler (mod387996.crm.dynamics.com/.../JsProvider.ashx;ids=1223231347-405283869:8854:18)

       at Object.<anonymous> (mod387996.crm.dynamics.com/.../JsProvider.ashx;ids=1223231347-405283869:8153:73)

       at Object.<anonymous> (mod387996.crm.dynamics.com/.../JsProvider.ashx;ids=727017229-892652631-1552783829:2:29705)

       at j (mod387996.crm.dynamics.com/.../JsProvider.ashx;ids=727017229-892652631-1552783829:2:28328)

       at Object.fireWith [as resolveWith] (mod387996.crm.dynamics.com/.../JsProvider.ashx;ids=727017229-892652631-1552783829:2:29148)

  • Suggested answer
    sandeepc Profile Picture
    5,514 on at

    1602.sample.PNGChange Function name to WarningAlert

  • Suggested answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

    JM, in function declaration change

    warningOnChange() to warningOnChange (functiona delcaration is shown on your last screenshot).

  • JDMCRM Profile Picture
    1,799 on at

    Hi Andrii,

    I've posted a screenshot below to ensure this is what you intended. Unfortunately I still can't get it to work (I haven't changed the code).

    Screen-Shot-2016_2D00_08_2D00_08-at-17.28.17.png

    Error Log:

    TypeError: Cannot read property 'Initialize' of undefined
    at eval (eval at RunHandlerInternal (mod387996.crm.dynamics.com/.../ClientApiWrapper.aspx), <anonymous>:1:26)
    at RunHandlerInternal (mod387996.crm.dynamics.com/.../ClientApiWrapper.aspx)
    at RunHandlers (mod387996.crm.dynamics.com/.../ClientApiWrapper.aspx)
    at mod387996.crm.dynamics.com/.../ClientApiWrapper.aspx
    at mod387996.crm.dynamics.com/.../MicrosoftAjax.js

  • a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Have you published changes you made?

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 > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans