Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Suggested answer

How to Hide Home page Activate and deactivate Button based on Javascript.

(0) ShareShare
ReportReport
Posted on by 5

Hi All,

I want to hide the Activate and deactivate button on home page grid of contact entity when i belongs to particular team.

When i am doing for form level ribbon and subgrid its working. but how can i do it fo Home page ribbon button?

can please nayone help?

Thanks in advance

  • Suggested answer
    Bipin D365 Profile Picture
    Bipin D365 28,961 Moderator on at
    RE: How to Hide Home page Activate and deactivate Button based on Javascript.

    HI,

    Can you please check if below method using async call to web api?

    Contact.IsTeamLead = rcm_common.UserHasTeam("ABC");

    Contact.IsCallCenterUser = rcm_common.UserHasTeam("PQR");

    If yes then you will have to modify your code to use promise to make it synchronous.

    ajitpatra.com/.../

    Please mark my answer verified if i were helpful

  • Roma Gupta Profile Picture
    Roma Gupta 725 on at
    RE: How to Hide Home page Activate and deactivate Button based on Javascript.

    Hi Monali

    You want to customize a system button. There are multiple system business rules based on those button. Hence the suggestion to use a new button & customize it. This would ensure that CRM as a whole is not corrupted. But this is not mandatory though.

    Few questions:

    1. Is your debugger getting called?

    2. Could you remove custom rule for NaN & try doing tests?

    Regards

    Roma

  • MonaliChavan123 Profile Picture
    MonaliChavan123 5 on at
    RE: How to Hide Home page Activate and deactivate Button based on Javascript.

    Hi Pankaj Thanks for your reply.

    why we need to create new buttons? it does not work for existing one?

    below is my function 

    Contact_Ribbon_ActivateDeactivateSubGrid: function (selectedControl) {


    debugger;
    //formContext=primaryControl.executionContext();

    Contact.IsTeamLead = rcm_common.UserHasTeam("ABC");
    Contact.IsCallCenterUser = rcm_common.UserHasTeam("PQR");

    if(selectedControl.length>0)
    {

    if (Contact.IsTeamLead || Contact.IsCallCenterUser) {
    return false;
    }
    else {
    return true;
    }
    }

    },

    and below is screen shot of my enable rule 

    pastedimage1598256907186v1.png

    i have referenced the coomon js as well.

    and instead of rcm_common.NaN is used isNaN as well but still not working. its not going in common.ja and getting the team for which i am checking.

  • Pankaj Gogoi Profile Picture
    Pankaj Gogoi 3,177 on at
    RE: How to Hide Home page Activate and deactivate Button based on Javascript.

    Hi Monali,

    Here is my suggestion.
    1. Hide the OOB Activate and Deactivate button on HomePage. Below is screen grab from Ribbon Workbench.

    pastedimage1598124135753v1.png


    2. Create two new button for Activate and Deactivate by copying from the Activate and Deactivate button.
    3. Create an Enable rule and call your Custom Javascript function to show / Hide based on condition on the new buttons.

    Hope this helps

    Best Regards

    PG

  • Suggested answer
    Bipin D365 Profile Picture
    Bipin D365 28,961 Moderator on at
    RE: How to Hide Home page Activate and deactivate Button based on Javascript.

    HI,

    Could you please share source code to check this issue?

    Please mark my answer verified if i were helpful

  • Suggested answer
    Roma Gupta Profile Picture
    Roma Gupta 725 on at
    RE: How to Hide Home page Activate and deactivate Button based on Javascript.

    Hi Monali

    Refer this link, even though its for CRM 2011 but implementation is similar

    www.crmsoftwareblog.com/.../

    Regards

    Roma

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,494 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,307 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans