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 :
Customer experience | Sales, Customer Insights,...
Suggested Answer

Automatically refresh ribbon on field value

(0) ShareShare
ReportReport
Posted on by 45

Hi

My main goal was to hide oppportunity "Close as Won" button and I've managed to do it with Ribbon Workbench and this topic https://community.dynamics.com/crm/f/microsoft-dynamics-crm-forum/275236/1094903

The button is hidden successfully, but after my trigger field "actualclosedate" in BPF is not null I have to press Save (or Refresh) for "Close as Won" to appear.

refreshRibbonOnChange function from this HowTo isn't working in my case (don't know why) https://ribbonworkbench.uservoice.com/knowledgebase/articles/121427-enable-disable-a-ribbon-button-dynamically-based-o

Is there any other way to refresh ribbon automatically after "actualclosedate" in is not null?

I have the same question (0)
  • Suggested answer
    Bipin D365 Profile Picture
    28,983 Moderator on at

    Hi,

    Try using formContext.ui.refreshRibbon(refreshAll); and check if it works.

    docs.microsoft.com/.../refreshribbon

    Please mark my answer verified if i were helpful

  • vahrameev Profile Picture
    45 on at

    Thank you for your answer.

    I'm using this function to update the ribbon

    function RefreshOppRibbon(){
        formContext.ui.refreshRibbon(true);
    }

    and I'm calling it on change of my Close tab (last tab/stage in BPF and when "actualclosedate" in is not null)

    but my ribbon isn't refreshing after "actualclosedate" was filled with date on previous step and Close tab becomes active

  • Suggested answer
    Miguel Lourenco Profile Picture
    on at

    Hi vahrameev,

    You're using formcontext but you're not passsing it as parameter in the function. Also you need to check 

    pastedimage1601297332672v1.png

    also, on the function should have

    function hi(formContext)

    {

    }

    Regards,

  • vahrameev Profile Picture
    45 on at

    Hi Miguel,

    I think I'm stil missing something, because this is not working in my case :-(

    Let me start from the beginning.

    "Close as Won" for opportunity is hidden with this function:

    function HideOppWonButton(){
        return  ((Xrm.Page.getAttribute("actualclosedate").getValue())!= null)
    }

    Function for ribbon autorefresh looks like this:

    function RefreshOppRibbon(formContext){
        formContext.ui.refreshRibbon(true);
    }

    These are my Form Properties settings:

  • Miguel Lourenco Profile Picture
    on at

    hi,

    can you add an alert() just to know if the function is getting called? similar to:

    function RefreshOppRibbon(formContext)

    {  

    alert('hi');

      formContext.ui.refreshRibbon(true);

    }

  • vahrameev Profile Picture
    45 on at

    Sorry, forgot to test it with alert myself before reporting.

    Did it right now, no alert was displayed.

    Also tried to show a simple alert on TabStateChange and also nothing.

    function showalert(){  
    alert('test function call');
    }

  • Miguel Lourenco Profile Picture
    on at

    Shouldn’t you add the field onchange to that Function refresh ?

  • vahrameev Profile Picture
    45 on at

    Can you please be more specific?

    You are talking about Dependencies tab in Handler Properties?

  • Miguel Lourenco Profile Picture
    on at

    you want to refresh the ribbon when a field changes right? Then you can add that refresh button to the onchange event of that field

  • vahrameev Profile Picture
    45 on at

    English is my third language so sometimes I can interpretate suggestions in the wrong way :-)

    Let me rephrase yours

    You suggest to find a way to "connect" my field "actualclosedate" and Refresh button in ribbon so every time data in "actualclosedate" is changed the Refresh button will be triggered?

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

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 72 Super User 2025 Season 2

#2
Daniyal Khaleel Profile Picture

Daniyal Khaleel 32 Most Valuable Professional

#3
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 29 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans