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
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,219 Super User 2024 Season 2
Martin Dráb 230,056 Most Valuable Professional
nmaenpaa 101,156