Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Run js function from Ribbon

(0) ShareShare
ReportReport
Posted on by 90

Hello ,

I have two buttons in home of incident and I open the same form with the two buttons, the only difference is the  value to pass it : if the departement have number 1(Customer Relationship) I hide the section of ticket and if the departement is 2 (Support).

My problems are in the ribbon ,when I put two javascript function  to have the right form , one function (XrmCore.Commands.Open.openNewRecord  to open the form )is executed and the not function in js file.

I try it with local storage no solution also when I try whith function whith consol.log I don't have any results

Thank's2-buttons-_2B00_details-of-command_2B00_the-two-javascript-function.png

2-buttons-_2B00_details-of-command_2B00_the-two-javascript-function.png

*This post is locked for comments

  • feninzie Profile Picture
    feninzie 90 on at
    RE: Run js function from Ribbon

    The probleme that I'm in the home page of the entity and the only function that works is "XrmCore.Commands.Open.openNewRecord" that open the form and when I associate a function in js file it's not running

  • RaviKashyap Profile Picture
    RaviKashyap 55,410 on at
    RE: Run js function from Ribbon

    Plus  1 for Goutam's suggestion. You can call XrmCore.Commands.Open.openNewRecord from your custom method before your logic.

  • Suggested answer
    gdas Profile Picture
    gdas 50,089 on at
    RE: Run js function from Ribbon

    Why not you declare one function and include all logic there  and register  one action only. Doing one function there is an advantage, you can debug and see where it's going .

  • semosby Profile Picture
    semosby 230 on at
    RE: Run js function from Ribbon

    Your images show the Open command running first.  When the open command runs a new form is opened and the subsequent command will not run unless it is in the On Open event of the form.

    If you're trying to hide/show different buttons on the form, you'll have to adjust your enable rules accordingly which could be based on the same field used in the section hiding.

  • RE: Run js function from Ribbon

    I can see two custom js actions in the command in the screenshot. According to the screenshot XrmCore.Commands.Open.openNewRecord should trigger first as it is the first custom js action.

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,409 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans