Skip to main content

Notifications

Announcements

No record found.

Customer experience | Sales, Customer Insights,...
Unanswered

How to Hide /Show the assign button based on login user team

Posted on by 790

Hi Folks,

I am going to hide /show Assign button in Custom entity record  based on login user team.

function getUserTeam(executionContext)
{
//debugger;
var isAsyncOperationCompleted = false;
var isButtonEnabled = false;

var formContext = executionContext.getFormContext();
var req = new XMLHttpRequest();
req.open("GET", Xrm.Page.context.getClientUrl() + "/api/data/v9.1/teams?$select=name&$filter=teamid eq C8CCF913-8F90-E611-8124-127B25DCBDE7", true);
req.setRequestHeader("OData-MaxVersion", "4.0");
req.setRequestHeader("OData-Version", "4.0");
req.setRequestHeader("Accept", "application/json");
req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
req.setRequestHeader("Prefer", "odata.include-annotations=\"*\"");
req.onreadystatechange = function()
{
if (this.readyState === 4)
{
debugger;
req.onreadystatechange = null;
if (this.status === 200)
{
var results = JSON.parse(this.response);
for (var i = 0; i < results.value.length; i++)
{
var Teamname = results.value[i]["name"];

if(Teamname=="EED Supervisor")
{
// Xrm.Utility.alertDialog(Teamname);
isButtonEnabled = true;
}

}
if (isButtonEnabled)
{
formContext.ui.refreshRibbon();
}

}
else
{
isButtonEnabled = false;
Xrm.Utility.alertDialog(this.statusText);
}
}
};
req.send();

}

Regards

Ajay ch

+91-9113813508

  • a33ik Profile Picture
    a33ik 84,323 Most Valuable Professional on at
    RE: How to Hide /Show the assign button based on login user team

    So my question is what rule did you apply to the command.

  • Dynamics Group Profile Picture
    Dynamics Group 790 on at
    RE: How to Hide /Show the assign button based on login user team

    Not a customised in ribbon then apply enable or disable able rule

  • a33ik Profile Picture
    a33ik 84,323 Most Valuable Professional on at
    RE: How to Hide /Show the assign button based on login user team

    Ok. I got it.

    In what way did you customize the button?

  • Dynamics Group Profile Picture
    Dynamics Group 790 on at
    RE: How to Hide /Show the assign button based on login user team

    Hi Andrew,

    Thanks for your response.

    I custom size the existing button

    (Assign button) Outof bix

  • a33ik Profile Picture
    a33ik 84,323 Most Valuable Professional on at
    RE: How to Hide /Show the assign button based on login user team

    Ok. Did you customize the existing button or added a custom one?

  • Dynamics Group Profile Picture
    Dynamics Group 790 on at
    RE: How to Hide /Show the assign button based on login user team

    Hi Andrew,

    Button is not showing in Ribbon

  • a33ik Profile Picture
    a33ik 84,323 Most Valuable Professional on at
    RE: How to Hide /Show the assign button based on login user team

    Ok. So what issue do you experience?

  • Dynamics Group Profile Picture
    Dynamics Group 790 on at
    RE: How to Hide /Show the assign button based on login user team

    Thank you so much

  • a33ik Profile Picture
    a33ik 84,323 Most Valuable Professional on at
    RE: How to Hide /Show the assign button based on login user team

    Hello,

    That looks like code from my blog post. So what issues do you experience?

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