3
The suggestion is to have access to client-side context data that contains the running users owner team names and guids, similar to globalContext.userSettings.roles (https://docs.microsoft.com/en-us/powerapps/developer/model-driven-apps/clientapi/reference/xrm-utility/getglobalcontext/usersettings#roles). This would simplify customers ability to develop custom javascript code to modify from elements based on the owner teams a running user is a member of and without having to make an api call to the platform.

Example of what customers are currently doing:
/**
* @function UserIsTeamMember
* @description Returns true if user is a member of owner team name passed in and
* caches the list of user teams names in the browser cache if the list is not already cached to limit repeat calls to the api for future request
* @teamName String with exact match of Owner Team name in question
* @return bool
*/
Spark30Common.UserIsTeamMember = async function (teamName) {
"use strict";
try{
if (typeof (Storage) !== "undefined") {
var userSettings = Xrm.Utility.getGlobalContext().userSettings;
// define a unique session storage name
var sessionStorageId = userSettings.userId + ".teams"
// if session storage with name does not exist populate it
let userteams
if (!sessionStorage.getItem(sessionStorageId)) {
// query for the current users team membership. Filtered owner teams
var teamFetchXml = "" +
"" +
"" +
"" +
"" +
"
" +
"" +
"" +
"" +
"
" +
"
" +
"
" +
"
"
var apiFetchXml = "?fetchXml=" + teamFetchXml

userteams = await Xrm.WebApi.retrieveMultipleRecords("team",apiFetchXml);

sessionStorage[sessionStorageId] = JSON.stringify(userteams);
}
// get configuration values from browser cache
var storedUserTeams = sessionStorage.getItem(sessionStorageId);
var returnValue = false;
// check for passed in configuration name
if (storedUserTeams) {
var userTeamResponse = JSON.parse(storedUserTeams);
for (var i = 0; i < userTeamResponse.entities.length; i++) {
if (userTeamResponse.entities[i]["name"] === teamName) {
returnValue = true;
break;
};
};
}
// return configuration value matching name or null if nothing is found
return returnValue;
}
} catch(ex){
Xrm.Navigation.openAlertDialog({ text: ex });
}
}
Category: Platform
STATUS DETAILS
New