web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Unanswered

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

(0) ShareShare
ReportReport
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

I have the same question (0)
  • a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Hello,

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

  • Dynamics Group Profile Picture
    790 on at

    Thank you so much

  • a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Ok. So what issue do you experience?

  • Dynamics Group Profile Picture
    790 on at

    Hi Andrew,

    Button is not showing in Ribbon

  • a33ik Profile Picture
    84,331 Most Valuable Professional on at

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

  • Dynamics Group Profile Picture
    790 on at

    Hi Andrew,

    Thanks for your response.

    I custom size the existing button

    (Assign button) Outof bix

  • a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Ok. I got it.

    In what way did you customize the button?

  • Dynamics Group Profile Picture
    790 on at

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

  • a33ik Profile Picture
    84,331 Most Valuable Professional on at

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

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
ManoVerse Profile Picture

ManoVerse 176 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 139

#3
CU11031447-0 Profile Picture

CU11031447-0 100

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans