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,...
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

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 74 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... 31 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans