Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Namespaced functions not gettting called on Quick create Form onLoad

Posted on by 45

I have a function mapped on Quick create formOnLoad event in Dynamics.

The script is : 

var CompanyName = (function (){

return {
testFn : function(){

console.log("a");

}
}

})({});

The function mapped is :  CompanyName.testFn

But it is unable to call.

This approach is working fine with other forms, but not for quickCreate

*This post is locked for comments

  • Suggested answer
    RaviKashyap Profile Picture
    RaviKashyap 55,410 on at
    RE: Namespaced functions not gettting called on Quick create Form onLoad

    Can you share your actual code then? Cause this sample works, I suspect some syntax error causing your script to fail. Did you check the dev console for any errors? Event with this sample code, I got the warning saying semicolon missing when I put it in visual studio.

    Hope this helps.

  • Sudhir Miglani Profile Picture
    Sudhir Miglani 45 on at
    RE: Namespaced functions not gettting called on Quick create Form onLoad

    Hi Ravi, this is working fine for small scripts containing 2-3 functions. But if my script is bundled and huge, it doesn't work.

    It sounds strange, but it's happening like this way only

  • Suggested answer
    RaviKashyap Profile Picture
    RaviKashyap 55,410 on at
    RE: Namespaced functions not gettting called on Quick create Form onLoad

    I tried the code you shared and it worked as expected on my Online V9 environment - Contact Quick Create. Are you getting any error?

  • Suggested answer
    gdas Profile Picture
    gdas 50,085 on at
    RE: Namespaced functions not gettting called on Quick create Form onLoad

    Hi Sudhir,

    Try with this  -

    var CompanyName = {  

       testFn: function () {

           console.log("a");

       }

    };

    Make sure you are calling function with namespace in the form onload event  like below    -

    CompanyName.testFn

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 Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans