Showing results for 
Search instead for 
Did you mean: 
Advocate IV
Advocate IV

Can't set record owner to a Team

In my model-driven app, I have a form for a custom entity that has a lookup field and the owner field on it.  When adding a new record, the owner defaults to the current user.  When a value is selected in the lookup field, I'm trying to get the owner value from the selected lookup value and set the owner of the record I'm adding to that value.  If the owner value is a User, it works fine.  But when the owner is a Team, I get the following error:


Uncaught (in promise) UciError: Value should be of type: entityType: Parameter Name: value[0].entityType


Here is my code that's executed in the onChange JavaScript event (with variable values hardcoded so you can see what they are):


                        ownerId = "cec4bd48-df38-eb11-a813-000d3a531257";

                        teamName = "Child Business Unit 1";

                        entityType = "team";


                        var lookupData = new Array();

                        var lookupItem = new Object();

               = ownerId;

               = teamName;

                        lookupItem.entityType = entityType;

                        lookupData[0] = lookupItem;

                        var fieldOwner = formContext.getAttribute("ownerid");



I also noticed that on the UI, if I click in the owner field, I can only search for users.  But using the Assign feature, I can assign it to this Team.  Is there another setting that I need to change to be able to set it to a Team in Javascript?



Advocate IV
Advocate IV

@cchannon - Just tried your code and getting the same error when entityType = "team":


Uncaught (in promise) UciError: Value should be of type: entityType: Parameter Name: value[0].entityType

Running in Edge:



Tried it again this morning looking at your code cchannon. Rewrote what I had, very dumbed down version, still doesn't work. I can confirm it works for users but not teams. Furthermore, it appears that I cannot select a team or business unit within a form as owner. I can, however, do a mass edit by selecting multiple records from the main grid, and this allows me to set teams as owners. I wonder if the issues related? Here is the dumbed down code:

function SetAdminOwner(executionContext) {

    var formContext = executionContext.getFormContext();

    var owner = [{ entityType: "team", id: "{52CEBC12-4550-EB11-A813-000D3A3263E5}", name: "Administration" }]




Well, you don't want the brackets in your id, but that is probably a downstream issue.

2021 release wave 1 enabled
Server version: 9.2.21053.00136
Client version: 1.4.2704-2105.3
Organization name:
Session ID: 76bca420-a72d-44fd-afaf-6195603275ab
Time: 6/24/2021 10:18:35 AM
Also running in edge.
I know it's baffling

Tried it both ways (with and without brackets). I do believe the brackets are correct though, try console.log on an existing owner and it will include the brackets. You just don't want to include them with your queries. Though I could be missing something, still consider myself new to Powerapps WebAPI.

Advocate IV
Advocate IV

@a33ik @ferris @cchannon @DianaBirkelbach 

MS support found the solution for us.  You have to add the Team entity to the list of entities in your App.  Once I added it to mine, the Owner lookup field in the UI allows for the selection of a Team, and they JavaScript code can set it to a Team value as well.  Thank you to Shiva Gandikota at Microsoft Support!

Ok good to hear! Will do that as soon as I get back to working on the app. Never even considered the need to do it with core default entities, but it makes sense. 

Helpful resources

Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Users online (4,207)