Hi All,
I have An requirement that I need to hide and show buttons based on teams of Current Users.
How to retrieve User Trams Using Javascript?
Please help me to achieve this requirement...

Hi All,
I have An requirement that I need to hide and show buttons based on teams of Current Users.
How to retrieve User Trams Using Javascript?
Please help me to achieve this requirement...
Hi,
var currentUserId = Xrm.Utility.getGlobalContext().userSettings.userId;
Xrm.WebApi.retrieveMultipleRecords('team', "?$select=name,_businessunitid_value,teamtype&$expand=teammembership_association($filter=(systemuserid eq " currentUserId "))&$filter=(teammembership_association/any(o1:(o1/systemuserid eq " currentUserId ")))").then(
function success(result) {
console.log(result)
},
function (error) {
console.log(error.message);
// handle error conditions
}
);
Manage Button visibility is tricky when you perform an async operation. Take a look to this greate example shared by Andrew:
https://butenko.pro/2018/11/13/showing-ribbon-button-based-on-the-result-of-async-operation/
Good Luck