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!

 

  • William Bradley Profile Picture
    175 on at
    RE: Show/Hide Close as Won based on 2 field values
    1. In SOLUTION ELEMENTS > ENABLE RULES, click the + to add a new Enable Rule, select ValueRule
    2. In this scenario, we want to Hide the Close as Won, EXCEPT when the field Date Submitted contains data, OR the field Proposal Submitted = Completed. To do this, we Add the field schema names, Values, and InvertResult as shown:
    3. Now we add the Enable Rule as a COMMAND to the Button. Click COMMANDS > Mscrm.Form.opportunity.MarkAsWon (this is the name of the Close as Won button in Ribbon Workbench)
    4. Publish Solution, refresh in D365 and test!
      This was a great solution to showing/Hiding the Close as Won button that works seamlessly in v9.0 and above, without combining with any JScript code, unlike previous versions of D365/CRM.  

    pastedimage1593708035917v2.png

    pastedimage1593708043398v3.png

    pastedimage1593708054455v4.png

  • William Bradley Profile Picture
    175 on at
    RE: Show/Hide Close as Won based on 2 field values

    I believe I figured it out.  I will post steps shortly - thanks guys for your help !!

  • William Bradley Profile Picture
    175 on at
    RE: Show/Hide Close as Won based on 2 field values

    Opened a new solution and started over, here is where I am in Ribbon Workbench, with the same code in D365 for refreshRibbon.  I have added questions below.  I think I just need a step-by-step in order of what to do in Ribbon Workbench.  

    pastedimage1593702682138v1.png

  • a33ik Profile Picture
    84,331 Most Valuable Professional on at
    RE: Show/Hide Close as Won based on 2 field values

    Can you please make a screenshot of "Solution Elements" - there is a chance that command was customized already.

  • Verified answer
    Bipin D365 Profile Picture
    28,981 Moderator on at
    RE: Show/Hide Close as Won based on 2 field values

    HI,

    You should use  Date Submitted and value as null instead of notnull. Also select invertresult to true.

    for Proposal Submitted you should not select invert result true. it should  be false only.

    Make sure you have mentioned correct fields schema name. If fields are custom field then you are missing prefix in field name.

    If found helpful, Please mark my answer verified.

  • William Bradley Profile Picture
    175 on at
    RE: Show/Hide Close as Won based on 2 field values

    OK, got it to publish with these EnableRules with OR condition, but then was showing the error highlighted below:


    I located the Close as Won button and right-clicked.  How do I add the Command as you mentioned?

    pastedimage1593701564406v1.png

  • Suggested answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at
    RE: Show/Hide Close as Won based on 2 field values

    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.

  • William Bradley Profile Picture
    175 on at
    RE: Show/Hide Close as Won based on 2 field values

    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

  • a33ik Profile Picture
    84,331 Most Valuable Professional on at
    RE: Show/Hide Close as Won based on 2 field values

    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
    RE: Show/Hide Close as Won based on 2 field values

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

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

Ramesh Kumar – Community Spotlight

We are honored to recognize Ramesh Kumar as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Holly Huffman Profile Picture

Holly Huffman 103

#2
Muhammad Shahzad Shafique Profile Picture

Muhammad Shahzad Sh... 96 Most Valuable Professional

#3
Gerardo Rentería García Profile Picture

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

Product updates

Dynamics 365 release plans