Skip to main content

Notifications

Community site session details

Community site session details

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

The JavaScript Function is not triggered

(0) ShareShare
ReportReport
Posted on by 360

Hi community,

I encountered an interesting error. I have a custom js library in the account entity. I added js function to phone field.

My js code :

function onChangeTelephone1(fieldname) { // PhoneNumber1
    var phone = Xrm.Page.getAttribute("telephone1").getValue();
    if (!phone) return true;

    var isSuccess = ControlPhoneForTurkey(phone,fieldname);

    return isSuccess;
}

I added the function to onchange event but it didnt trigger.

I tried to fix the problem;
- I created a new library and moved the codes to this library.
- I opened the developer console by adding a debugger to the code, it didn't trigger.
- I confirmed that the library of the function I added to the onchange event of the phone number field on the form is correct.

Despite all this, I could not trigger the code somehow. Moreover, this development was working without any problems 2 days ago. 

I shared screenshots:

1- Error details (web resources does not contain)

pastedimage1655733302769v1.png

2- OnChange event and library information 

pastedimage1655733363177v2.png

pastedimage1655733409431v3.png

The browser does not enter debug mode even though I have made changes to the field.

Could you please help me ?

Thanks in advance. 

Regards.

  • onurizgi Profile Picture
    360 on at
    RE: The JavaScript Function is not triggered

    Hi Arshad,

    It's actually my cache clear. All I skipped was try from a different browser :/ I tried different browser. It was successed. Thank you very much everyone.

  • onurizgi Profile Picture
    360 on at
    RE: The JavaScript Function is not triggered

    Hi Bipin,

    I checked to js code in esprima website. There isn't any error. Validation successed

    pastedimage1655792523061v1.png

    I'm pretty sure I published the code anyway I just re-published it and the problem didn't change.

  • onurizgi Profile Picture
    360 on at
    RE: The JavaScript Function is not triggered

    Hi Amit,

    Of course I confirmed, It is not possible to choose from the event area without the library anyway.

    pastedimage1655792153900v1.png

  • Verified answer
    Community Member Profile Picture
    on at
    RE: The JavaScript Function is not triggered

    Hi,

    I have copy same your code in my trail crm. it is working fine. i have given the debugger as well on the phone number change. Please find the below screenshot for your reference.

    pastedimage1655749366265v1.png 

    pastedimage1655749465492v2.png

    pastedimage1655749494632v3.png

    Please try to clear you cache memory and try again it will be work.

    Thanks,

    Arsahd

    Please like and subscribe my youtube channel and follow my blog as well for interview preparation and more update please.

    https://www.youtube.com/channel/UC3Pe9Y_2SxA9xAmTfuSWQaA/videos

    https://juniorcrmblog.blogspot.com/

  • Suggested answer
    Bipin D365 Profile Picture
    28,981 Moderator on at
    RE: The JavaScript Function is not triggered

    Hi,

    Make sure web resource library has correct js syntax. Validate using below online tool

    esprima.org/.../validate.html

    Also, I hope you have published your customization.

  • Suggested answer
    Amit Katariya007 Profile Picture
    10,407 Super User 2025 Season 1 on at
    RE: The JavaScript Function is not triggered

    Hello   ,

    Can you confirm that the given function is present in the Selected library?

    pastedimage1655738340661v1.png

    Thank you,

    Amit katariya

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

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Daivat Vartak (v-9davar) Profile Picture

Daivat Vartak (v-9d... 225 Super User 2025 Season 1

#2
Muhammad Shahzad Shafique Profile Picture

Muhammad Shahzad Sh... 106 Most Valuable Professional

#3
Eugen Podkorytov Profile Picture

Eugen Podkorytov 102

Overall leaderboard

Product updates

Dynamics 365 release plans