web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Answered

Setting lookup field value in JavaScript throwing error in uclient script

(0) ShareShare
ReportReport
Posted on by

I have a function to set a lookup field which works for the classic version of the form but not in the unified interface version.

This error is thrown in UI:  UciError: Value should be of type: entityType: Parameter Name: value[0].entityType


pastedimage1598449790679v1.png

The error appears to be thrown in one of the UCI scripts:

pastedimage1598450024494v2.png

I have the same question (0)
  • a33ik Profile Picture
    84,331 Most Valuable Professional on at
    RE: Setting lookup field value in JavaScript throwing error in uclient script

    Hello,

    Can you please provide the code that calls this setLookupField function?

  • Community Member Profile Picture
    on at
    RE: Setting lookup field value in JavaScript throwing error in uclient script

    var formContext = executionContext.getFormContext();
    var result = XrmServiceToolkit.Soap.Fetch(fetchXml);

    if (result.length > 0) {
       caseManagerTeamId = result[0].attributes["ofs_team"].id;
       caseManagerTeamName = result[0].attributes["ofs_team"].name;
    }

    setLookupField(formContext, "ofs_casemanagerteam", caseManagerTeamId, caseManagerTeamName, "Team");

  • Verified answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at
    RE: Setting lookup field value in JavaScript throwing error in uclient script

    Thanks, that's the answer - don't use "Team", use "team". In the client scripts use lowercased entity names.

  • Suggested answer
    Community Member Profile Picture
    on at
    RE: Setting lookup field value in JavaScript throwing error in uclient script

    Fantastic, thank you Andrew!  Oddly enough, this worked in the classic view.

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.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Pallavi Phade – Community Spotlight

We are honored to recognize Pallavi Phade as our Community Spotlight honoree for…

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 83 Super User 2025 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 57 Most Valuable Professional

#3
Tom_Gioielli Profile Picture

Tom_Gioielli 52 Super User 2025 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans