Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics 365 | Integration, Dataverse...
Answered

I need lil help with javascript.

(0) ShareShare
ReportReport
Posted on by 814

Hi

I have written a javascript function and everything is working fine. i called the function on save. Then I found another way which is as below.

My way is 

Function setfocus()

{//my code

}

Function setfocus()

{//my code

}

Another way is as below... why this type of and then all these things are done. created crm object and taken all functions in it. how this is helpful

if (typeof (CRM) == "undefined") {
CRM = {};
}

CRM.WorkOrderFormFunctions= {
setfocus: function (context) {

//code

}}

  • Verified answer
    Bipin D365 Profile Picture
    Bipin D365 28,959 Super User 2024 Season 1 on at
    RE: I need lil help with javascript.

    Hi,

    One of the benefit of using namespace is to group your functions in logical container. You can have same function name inside different namespace and will not cause any issue in CRM.

    Please mark my answer verified if i were helpful

  • Verified answer
    a33ik Profile Picture
    a33ik 84,325 Most Valuable Professional on at
    RE: I need lil help with javascript.

    Hello,

    This is one of ways to use namespaces in JavaScript. Check this post - jlattimer.blogspot.com/.../namespaces-in-crm-javascript.html

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

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,458 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans