Skip to main content
Dynamics 365 general forum
Unanswered

Getting JS error setting team owner.

editSubscribe (0) ShareShare
ReportReport
Posted on by 185

var olook = [];
var lookup = {};
lookup.id = "8a7a2996-c11d-e911-a841-000d3a1f4157";
lookup.entityType = "team";
lookup.name = "Tax Team";
olook[0] = lookup;
formContext.getAttribute("ownerid").setValue(olook);

This code results in the following error and I'm not sure what the problem is. The ID/Name are correct for that team.

"Value should be of type: entityType: Parameter Name: value[0].entityType"

  • Community Member Profile Picture
    Community Member UG Leader on at
    RE: Getting JS error setting team owner.

    Hi JFulfordMS,

    Glad your code worked!

  • JFulfordMS Profile Picture
    JFulfordMS 185 on at
    RE: Getting JS error setting team owner.

    I actually found that the error was because the Team entity had not been added to the App. Once I added Team to the app the code worked as expected. Really terrible error message and quite an odd requirement.

  • Community Member Profile Picture
    Community Member UG Leader on at
    RE: Getting JS error setting team owner.

    Hi JFulfordMS,

    I copied your code and it can run successfully in my environment.

    function setLookup(executionContext)
    {
    // Getting Form Context
    var formContext = executionContext.getFormContext();

    var olook = [];
    var lookup = {};
    lookup.id = "177f29f1-7ff3-ec11-bb3d-000d3a34996f";
    lookup.entityType = "team";
    lookup.name = "Tax Team";
    olook[0] = lookup;
    formContext.getAttribute("ownerid").setValue(olook);

    }

    pastedimage1656049663671v1.png

    Maybe you can try to click the owner field and select the team on the form, Check if manual changes can be made successfully?

    And you can try to clear browser cache to test again.

Helpful resources

Quick Links

What Motivates a Super User?

We know many of you visit the Dynamics 365 Community and Power Platform…

Demystifying Copilot with Georg Glantschnig…

Industry experts answer burning questions directly from our amazing Community…

Setting Up Knowledge Sources for Copilot…

Look at how configuring a comprehensive knowledge base is crucial…

Leaderboard

#1
Andre Arnaud de Calavon Profile Picture

Andre Arnaud de Cal... 283,030 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 222,562 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,138

Product updates

Dynamics 365 release plans