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)

Subgrid Ribbon Flyout button works from a one associated entity but not for another associated entity

(0) ShareShare
ReportReport
Posted on by

Hi All

I'm seeing a very unusual issue with a subgrid ribbon button (2 buttons on a flyout anchor control) in CRM 2016.

In summary :

From one entity when I access an associated view and click on the function it calls the javascript Command behind the button and works fine. ......BUT from a different entity when I access an associated view and click on the same function button it does not trigger or call the javascript function at all. Nothing whatsoever happens.

In other words the same ribbon button on a subgrid ribbon (for bookings) is working in associated view from a Contact entity, but not from another Ticket entity. 

The ribbon is created for a Booking entity which can be associated with both Contacts and Tickets.

In my ribbon I have the a flyout anchor with 2 different buttons which call the same javascript function via the Command property on the <button>.

The javascript is passed a CommandValueId via CommandProperties in order to set a status on the selected rows in the grid.

Bookings can be seen via associated view on Contact, or from an associated view on Ticket.

If I access the ribbon via the Contacts and check the associated Bookings for that Contact and I click the ChangeStatus buttons for Preliminary or Confirmed status, the javascript function is called and status processed via the function. 

However doing the same from the Ticket entity, the Command behind the buttons is never triggered and the javascript never called.

Since this works for one entity and not another, I do not feel the problem is with the javascript or with the ribbon definition, but I include the ribbon definition of the CustomAction below.

<CustomAction Id="subGrid.booking.ChangeStatus.CustomAction" Location="subGrid.booking.MainTab.Controls._children" Sequence="10">
<CommandUIDefinition>
<FlyoutAnchor Command="Grid.booking.ChangeStatus.Cmd" Id="subGrid.booking.ChangeStatus" Image16by16="$webresource:changestatus.16.png" Sequence="10" TemplateAlias="o1">
<Menu Id="subGrid.booking.ChangeStatus.Menu">
<MenuSection Id="subGrid.booking.Section1.Section" Sequence="5" DisplayMode="Menu16">
<Controls Id="subGrid.booking.Section1.Section.Controls">
<Button Command="subGrid.booking.ChangeStatus.Change.Cmd" CommandValueId="30" Id="subGrid.booking.ChangeStatus.Preliminary" Image16by16="preliminary.16.png" Sequence="10" TemplateAlias="" />
<Button Command="subGrid.booking.ChangeStatus.Change.Cmd" CommandValueId="20" Id="subGrid.booking.ChangeStatus.Confirmed" Image16by16="confirmed.16.png" Sequence="20" TemplateAlias="" />
</Controls>
</MenuSection>
</Menu>
</FlyoutAnchor>
</CommandUIDefinition>
</CustomAction>

I would really like to know if anyone has an explanation for this or if anyone has experienced similar issue before.

Thanks

*This post is locked for comments

I have the same question (0)
  • Sravan Kumar Chandhavolu Profile Picture
    140 on at

    I'm not sure whether inline with your problem, I happened to go through a similar problem that the function was not getting called, then later upon investigation I realized there were 2 different functions getting loaded from different scripts and for some reason weirdly, nothing was getting called up. I know this wouldn't solve your problem, but just leaving a thought. Thanks.

  • Community Member Profile Picture
    on at

    Thanks I'll have a look at the scripts in the formLoad and see if there are any clashes maybe.

  • Suggested answer
    razdynamics Profile Picture
    17,308 User Group Leader on at

    Hi I think the Javascript might be failing or dependant library is not loaded. Please Check if all parameters are passed correctly to your method. add debugger or show some alerts that will make sure that javascript is being called. Please also check the browser console.

    Best Wishes, Raz

  • Community Member Profile Picture
    on at

    Thanks Raz. I suspect the same thing, it works fine in one place but not in another within the system, but the order of JavaScripts being loaded on the pageload is different for both, and I also suspect a clash but finding it hard to nail down.

    Thanks for the response.

    K

  • Community Member Profile Picture
    on at

    After many hours of investigating JavaScript and JavaScript loading and trying to detect if it was some sort of clash happening I finally figured out that it has something to do with the CommandCore in the Ribbon.

    When I open the solution in RibbonWorkbench and look at the Flyout menu's, each of the buttons has a CommandCore of  subGrid.booking.ChangeStatus.Change.Cmd

    I created a second Flyout menu with the same structure and pointed the buttons at a new Command, but which pointed at the same JavaScript function. I did not specify any CommandCore and this worked. I then investigated by removing the CommandCore from one of the buttons in the troublesome Flyout and selecting the command to be the new command and it works for that one button.

    It would seem that having the 2 Flyouts with the same CommandCore is somehow messing things up, but I do not know enough about CommandCore or how it works to be able to figure out exactly why??

    I did notice there is no CommandCore in the customizations XML and I only see it directly in RibbonWorkbench.

    Can anyone please explain to me how the CommandCore works?

  • Community Member Profile Picture
    on at

    Thanks again for the answer.

    Yes it would seem that there is something strange going on with the JavaScript or the loading of it. However I cannot figure out why.

    The associated view ribbon is shown in 2 places as mentioned.

    If I observe the Network tab in chrome and check the loading of resources and JavaScripts I see that all of the JavaScripts behind the button get loaded properly. The last file to get loaded is a ribbon specific file with the functions for the custom ribbon buttons and functionality. 

    However, on the other entity where I see a problem, when I check the loading of scripts as I click the button/function that does not work, the JavaScript file which contains the ribbon function calls is not loaded (and obviously this is why the function never gets called). All files up to that point are loaded but not that last vital one. 

    Since it loads under 1 entity fine,  but not under another I do not think that there is anything wrong with the JavaScript file itself (otherwise it would also fail to load on the other entity), but as I said, I'm none the wiser as to why this is the case.

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