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

Notifications

Announcements

No record found.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 83 Super User 2025 Season 2

#2
Gerardo Rentería García Profile Picture

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

#3
#ManoVerse Profile Picture

#ManoVerse 40

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans