Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested answer

Custom button on dashboard - cannot get primary control

(1) ShareShare
ReportReport
Posted on by 125

Hi,

I have prepared a new custom button on dashboard ribbon. Unfortunately when I pass primary control or selected control parameter, in JS function these variables becomes nulls.

Is it any other way to pass primary control object to function? What I want to achieve to have possibility of refreshing navbar in function.

  • Francisco Murtinheira Profile Picture
    on at
    RE: Custom button on dashboard - cannot get primary control

    Hi,

    I would advise you to open a ticket with Microsoft Support, so they can have a proper look at your environment and understand the reason for the null value.

  • CSD365 Profile Picture
    125 on at
    RE: Custom button on dashboard - cannot get primary control

    Hi,

    Thanks for reply.

    Unfortunately this dashboard contains few entities like activities and salesorders and as I described it, I have tried to pass selectedControl as parameter but in my case it's always null value.

  • Suggested answer
    Francisco Murtinheira Profile Picture
    on at
    RE: Custom button on dashboard - cannot get primary control

    Hello Dominik,

    First I am assuming that you configured your dashboard with an entity list and then on your ribbon workbench you customized the Homepage grid of the entity in question.

    For grids the form context does not exist, so we have to use the grid context (SelectedControl).

    Please find below the configuration I did on my trial and it seems to work fine in refreshing just the specific entity grid.

    pastedimage1594806478918v1.png

    pastedimage1594806486402v2.png

    function testjs(context)

    {

    context.refresh();

    }

    Hope this helps.

  • CSD365 Profile Picture
    125 on at
    RE: Custom button on dashboard - cannot get primary control

    Hi,

    What should I type for entityType property? If I provide "dashboard" it doesn't refresh, If I provide blank string or null, it throws an error.

  • Bipin D365 Profile Picture
    28,981 Moderator on at
    RE: Custom button on dashboard - cannot get primary control

    Hi,

    Check below link.

    debajmecrm.com/.../

    If found helpful, Please mark my answer verified.

  • CSD365 Profile Picture
    125 on at
    RE: Custom button on dashboard - cannot get primary control

    Hi,

    Thanks for reply, but based on my knowledge method refreshRibbon is available on object formContext.ui. Unfortunately, as I wrote I cannot access in any way to it, because primary control object is passed as null. In UCI interface I don't have direct method refreshRibbon and also I would like to avoid Xrm.Page object. Any other ideas?

  • a33ik Profile Picture
    84,331 Most Valuable Professional on at
    RE: Custom button on dashboard - cannot get primary control

    Try to call refreshRibbon function directly.

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 > Customer experience | Sales, Customer Insights, CRM

#1
Daivat Vartak (v-9davar) Profile Picture

Daivat Vartak (v-9d... 225 Super User 2025 Season 1

#2
Muhammad Shahzad Shafique Profile Picture

Muhammad Shahzad Sh... 97

#3
Vahid Ghafarpour Profile Picture

Vahid Ghafarpour 82 Super User 2025 Season 1

Overall leaderboard

Product updates

Dynamics 365 release plans