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)

Ribbon Workbench Assign JavaScript Function

(0) ShareShare
ReportReport
Posted on by

Hello, as the title states I am trying to assign a javascript function to a custom ribbon button. I can create and assign it without issue but the actual button does not do anything when clicked. I have tried to use the lookup for the library as well as typing the name with no luck so far.

Do you have any thoughts on that?

Thanks for you time.

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Andreas Cieslik Profile Picture
    9,267 on at

    This sample should give you a clue on how to implement your JavaScript on a button:

    ribbonworkbench.uservoice.com/.../140652-create-a-dialog-short-cut-ribbon-button

  • Community Member Profile Picture
    on at

    Hello Andreas and thank you for your response.

    I can open urls and pages without much troubles.

    The problem starts when I want to call a function upon the click. Even a pure javascript function (eg an alert) does not get executed.

    The blog explains how to call dialogs.

  • tw0sh3ds Profile Picture
    5,600 on at

    Share the code of your library you use (simplified to at most few lines, of course) and the screenshot how are you binding the function to the button.

  • Andreas Cieslik Profile Picture
    9,267 on at

    In the blog is shown how to call dialogs, but you can use your JavaScript instead.

    The important thing is to correctly setup the button commands which is explained in this blog as well as on which level (form , grid, or homepage) Can you try to compare and adapt from the blog to make your thing work?

  • Community Member Profile Picture
    on at

    2017_2D00_07_2D00_19_5F00_16_2D00_21_2D00_50.png

    function OpenIndex();
    {
        alert("test button");
    }

    I am trying to call a very simple function just to test it. The first function I have tried had an Ajax request and I thought it was the problem, but this does not work even when calling an alert.

    [quote user="Andreas Cieslik"]

    In the blog is shown how to call dialogs, but you can use your JavaScript instead.

    The important thing is to correctly setup the button commands which is explained in this blog as well as on which level (form , grid, or homepage) Can you try to compare and adapt from the blog to make your thing work?

    [/quote]

    Andreas I have tried to follow it but when I add enable rules or display rules they all differ from the version in the blog and the one that I am using currently

  • Suggested answer
    Andreas Cieslik Profile Picture
    9,267 on at

    Here is another guide:

    mahenderpal.wordpress.com/.../calling-java-script-on-click-of-command-button-ms-crm-2015-step-by-step

    In your screenshot we cannot see your complete solution elements structure. Also it would be interesting to see your button configuration.

  • Verified answer
    tw0sh3ds Profile Picture
    5,600 on at

    If your function really looks like that:

    function OpenIndex();
    {
        alert("test button");
    }


    then the problem is with the ";" after function name (OpenIndex();)

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