Skip to main content

Notifications

Announcements

No record found.

Service | Customer Service, Contact Center, Fie...
Answered

Ribbon Button Visibility Control

Posted on by 360

Hello Community,

I have a custom entity. I added 2 custom buttons. I added display rule but I think so this is not run right.  I want to do when two buttons appear at the onload of the form. After the form is saved, if the job started, "Job Start", if the job done, "Jobe Done" button to hide. So while one button is visible, the other is invisible. 

pastedimage1610024356598v2.png

Please help this subject to me.
Thanks/Regars.
  • onurizgi Profile Picture
    onurizgi 360 on at
    RE: Ribbon Button Visibility Control

    Hi Leah,

    Greate, resolved! Thank you so much

  • Verified answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Ribbon Button Visibility Control

    Hi Onur,

    As your screenshot shown, you have two field to control two buttons Separately, you can set them like following screenshot.

    For JobStart button:

    pastedimage1610100275939v1.png

    For JobDone button:

    pastedimage1610100356514v2.png

    And just add refersh js code to onSave event.

    Test:

    when field value is yes, the button can show, if it is no, the button will be hidden.

    pastedimage1610100438682v3.png

    if you still can't achieve it.

    1.you can move button to the front of the bar.

    pastedimage1610100636459v5.png

    2.you can try to use 'value rule' of  'enable rule' to test again.

    pastedimage1610100622224v4.png

    Regards,

    Leah Ju

    Please mark as verified if the answer is helpful. Welcome to join hot discussions in Dynamics 365 Forums.

  • onurizgi Profile Picture
    onurizgi 360 on at
    RE: Ribbon Button Visibility Control

    Hi Leah,

    Thank you so much for your good explanation. I think so I skipped a point :(

    My 2 fields are two options type. Both of us default value false. So they cannot be empty. I tried all the your stages. Both buttons are hidden. I share what I have done below. Can you fix it if I did it wrong? I'll be glad, if you help me :)

    1. I added your shared script 

    pastedimage1610084436165v1.png

    2. I added function jobstarted field onchange 

    pastedimage1610084499191v2.png

    3. I added onsave

    pastedimage1610084528753v3.png

    4. Create display rules for Job Start Button

    pastedimage1610085979388v5.png

    pastedimage1610086024064v6.png

    5. Create display rules for Job Done Button

    pastedimage1610086088526v7.png

    pastedimage1610086130635v8.png

    6. I was tried.

    pastedimage1610086215493v10.png

    So thanks.

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Ribbon Button Visibility Control

    Hi Onur,

    1..Add refresh javascript code to the job field onChange event.

    (1)Js code:

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

    (2)Add js as web resource.

    Go Settings > Customizations > Customize the system > Web Resource.

    pastedimage1610073933501v1.png

    (2) Add it to the field onChange event.

    Go Settings > Customizations > Customize the system > entities > entity you need > forms to open main form, then click 'Form Properties'.

    pastedimage1610074345229v3.png

    pastedimage1610074316383v2.png

    if you want to show changed after clicking save button, you can add it to the onSave button.

    pastedimage1610078657032v2.png

    2.You need do following settings in ribbon workbench.

    (1) Set Job Start button.

    pastedimage1610078539524v1.png

    (2) Set Job Done button.

    pastedimage1610078236960v9.png

    3.Test.

    (1)Job field is null.

    pastedimage1610075705874v4.png

    (2)Job field is not null.

    pastedimage1610075855874v7.png    pastedimage1610075759110v6.png

     

    Regards,

    Leah Ju

    Please mark as verified if the answer is helpful. Welcome to join hot discussions in Dynamics 365 Forums.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans