Announcements
No record found.
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
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.
Congratulations to our community stars!
Expanding mentorship, skilling, and AI innovation
These are the community rock stars!
Stay up to date on forum activity by subscribing.
11manish 77 Super User 2026 Season 2
ParthPatel249 56
André Arnaud de Cal... 44 Super User 2026 Season 2