web
You’re offline. This is a read only version of the page.
close
Skip to main content
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)
  • Verified answer
    tw0sh3ds Profile Picture
    5,600 on at
    RE: Ribbon Workbench Assign JavaScript Function

    If your function really looks like that:

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


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

  • Suggested answer
    Andreas Cieslik Profile Picture
    9,267 on at
    RE: Ribbon Workbench Assign JavaScript Function

    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.

  • Community Member Profile Picture
    on at
    RE: Ribbon Workbench Assign JavaScript Function

    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

  • Andreas Cieslik Profile Picture
    9,267 on at
    RE: Ribbon Workbench Assign JavaScript Function

    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?

  • tw0sh3ds Profile Picture
    5,600 on at
    RE: Ribbon Workbench Assign JavaScript Function

    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.

  • Community Member Profile Picture
    on at
    RE: Ribbon Workbench Assign JavaScript Function

    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.

  • Suggested answer
    Andreas Cieslik Profile Picture
    9,267 on at
    RE: Ribbon Workbench Assign JavaScript Function

    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

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…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
Aric Levin - MVP Profile Picture

Aric Levin - MVP 2 Moderator

#2
MA-04060624-0 Profile Picture

MA-04060624-0 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans