Advertisements
Home > CRM 2011, JScript > Loading dependent jscript libraries in ribbon button’s execution CRM 2011

Loading dependent jscript libraries in ribbon button’s execution CRM 2011

Hi,

I have a ribbon button on my “Account” main grid .

I am calling function “sayHello” which is in my web resource “account_ribbon” by defining custom action like below.

<Actions>

<JavaScriptFunction Library=”$webresource:account_ribbon” FunctionName=”sayHello”>

</JavaScriptFunction>

</Actions>

Now the problem is, I need to call another method from my “sayHello” function, which is in other web resource “common”.

Solution :-

The solution is simple. We can add all the required libraries to <Actions> node like below

 <JavaScriptFunction Library=”$webresource:common” FunctionName=”isNaN” />

Note – Since <JavaScriptFunction> requires a function name, pass “isNaN”.

Now my <Actions> node look like below

<Actions>

<JavaScriptFunction Library=”$webresource:account_ribbon” FunctionName=”sayHello”>

</JavaScriptFunction>

<JavaScriptFunction Library=”$webresource:common” FunctionName=”isNaN”>

</JavaScriptFunction>

</Actions>

🙂

Advertisements
  1. June 6, 2012 at 7:46 PM

    pretty neat trick… 🙂

  2. Manmath
    June 11, 2012 at 8:23 PM

    Thanks dude. You saved my day with this neat and clean solution

  3. Michal Dabrowski
    November 29, 2013 at 8:55 PM

    I lost a day trying to achive this… Thanx a lot!

  4. March 19, 2015 at 7:59 PM

    Thanks mate!!!

  5. June 25, 2015 at 4:11 PM

    cool trick, very nice Rajeev

  6. November 16, 2015 at 10:26 PM

    When I do this, I get a JavaScript error on page load. Anyone know why?

  7. November 16, 2015 at 10:28 PM

    When I do this, I get a JavaScript error on page load. Anyone know why?

    Microsoft Dynamics CRM Error Report Contents

    1.0

    Syntax error
    1

    /userdefined/edit.aspx?etc=10018&pagemode=iframe&preloadcache=1447693061714

    Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/7.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E)
    en-US
    en-US
    en-US
    1821×1024
    Web
    2015-11-16T11:57:42

    1033
    1033
    1033
    1033
    {91BAFA3F-150E-E511-9261-005056B96207}
    {4A44E95D-1F0E-E511-9261-005056B96207}
    5.0.9690.4376

  1. June 8, 2012 at 12:54 AM
  2. December 18, 2012 at 4:51 AM
  3. May 25, 2014 at 8:20 PM

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: