web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Answered

Show/Hide Close as Won based on 2 field values

(0) ShareShare
ReportReport
Posted on by 175

On the Opportunity record, I have a requirement that once in the "Close Bid" business process flow stage, when either of the fields "Date Submitted" or "Proposal Submitted", that only then will a user see the 'Close as Won' button in the ribbon, else, it is hidden. 

I currently have this button hidden with Ribbon Workbench, and am using a custom field and a workflow to close the record, but am running into some issues when reopening, etc. 

Does anyone have sample code to show/hide the button based on the above?  This way my issues will be resolved, and the users can have the full OOB Close as Won dialog box functionality.  Let me know, thanks!

 

I have the same question (0)
  • Suggested answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Christopher,

    I believe following KB is pretty close to what you want to achieve - ribbonworkbench.uservoice.com/.../121427-enable-disable-a-ribbon-button-dynamically-based-o

  • William Bradley Profile Picture
    175 on at

    Thanks Andrew. This looks very old (2011). I am not a coder, so I am just looking for the basic code to show/hide, and then the steps in Ribbon Workbench to implement.

  • Suggested answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Christopher,

    All of code that is required there is the one with refreshribbon. Remaining part is just configuration using ribbon workbench.

  • William Bradley Profile Picture
    175 on at

    Thanks.  I tried but to no avail.  Is there another way using updated code for v9.0 and RIbbon Workbench 2016?

  • Verified answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Christopher,

    I'm pretty sure that this approach works because I used it and it worked for me.

    Post here what you've done so far and let's try figure out what went wrong.

  • William Bradley Profile Picture
    175 on at

    Here is what I have done so far.
    -Open Ribbon Workbench 2016, Unhide 'Close as Won' button (was previously hidden as mentioned above)
    -Publish and Reopen Solution - verify Close as Won button shown in D365 

    -Create web resource, type JScript, with below and save and publish:

    function refreshRibbonOnChange()
    {
        Xrm.Page.ui.refreshRibbon();
    }

    -Add library to form library
    -Add 2 Events OnChange of following fields - datesubmitted, presentproposal - add function name and pass parameters
    -Save and publish form 

    -In Ribbon Workbench, click on Solution Elements, Button, and Click on Enable Rules and +
    -Create OrRule and 2 ValueRules shown below:

    pastedimage1593692512791v2.png

    I believe the last step in Ribbon Workbench is incorrect.  I am not sure how I select/indicate the button for Close as Won, nor do I think the OrRule and ValueRule (Value notnull, completed) are correct. 

    It seems basic, I just need Close as Won ONLY SHOWN in the form ribbon when Date Submitted Contains Data OR Proposal Submitted = Completed.  Need some help here, thanks!

  • William Bradley Profile Picture
    175 on at

    Also keep in mind that both fields mentioned above are in the Business Process Flow (I have them on the form also, but hidden)

  • a33ik Profile Picture
    84,331 Most Valuable Professional on at

    So as I assumed rules were not configured the right way.

    For datesubmitted - use null value and 'true' in invert result that can be read as detesubmitted contains some value.

    For presentproposal - you should use either true or false because it's of boolean type. So no 'completed' but 'true' I believe.

    Also can you please show where you've added that enablerule?

  • William Bradley Profile Picture
    175 on at

    OK, made the updates and get an error on Publish below:
    pastedimage1593700288081v1.png

    As for where I added the enable rule, see screenshot.  I clicked Button, then Solution Elements, then + next to Enable Rules:

    pastedimage1593700378308v2.png

  • Suggested answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Not sure regarding the error - you will have to troubleshoot it yourself.

    Regarding the rule - if you haven't added rule to command (in this case it should be rule of you "Win" button) - it will not work so... add this rule to the Command of Win Button.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Muhammad Shahzad Shafique Profile Picture

Muhammad Shahzad Sh... 69 Most Valuable Professional

#2
ManoVerse Profile Picture

ManoVerse 60 Super User 2026 Season 1

#3
11manish Profile Picture

11manish 43

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans