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 94

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
    94 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
    55,410 Moderator 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
    50,091 Moderator 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
    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.

  • Dynamics Objects 365 Profile Picture
    550 on at
    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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Microsoft Dynamics CRM (Archived)

#1
Mohamed Amine Mahmoudi Profile Picture

Mohamed Amine Mahmoudi 83 Super User 2025 Season 1

#2
Community Member Profile Picture

Community Member 52

#3
Victor Onyebuchi Profile Picture

Victor Onyebuchi 6

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans