Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

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

Lookup field value Overwritten Original value

(2) ShareShare
ReportReport
Posted on by 5,388
unexpected error
Categories:
  • Verified answer
    Jeevarajan Kumar Profile Picture
    769 Most Valuable Professional on at
    Lookup field value Overwritten Original value
     Hi Sandeep,

    Few things, by the looks of it, itseems that lookup field_2 is a polymorphic lookup field.
    Step1: Make sure that it's multi entity polymorphic field since you cannot set a "concatenated" value into a single lookup polymorphic field.
    Step 2: it seems there are few issues in the code. 1.  dont do JSON parse, use the object directly. 2. Don't use Split, its not a string as its an object. 3. Key issue here is the concat, try something like this rather
     
     // Merge and remove duplicates
        const merged = [...lookup field_2];
        lookup field_3.forEach(item => {
            if (!merged.some(existing => existing.id === item.id && existing.entityType === (item.entityType || item.logicalName))) {
                merged.push({
                    id: item.id,
                    name: item.name,
                    entityType: item.entityType || item.logicalName
                });
            }
        });
        formContext.getAttribute("lookupfield_2").setValue(merged);

    Please mark my answer as Yes if it helps!
  • sandeepc Profile Picture
    5,388 on at
    Lookup field value Overwritten Original value
    Sales @andre
  • André Arnaud de Calavon Profile Picture
    294,261 Super User 2025 Season 1 on at
    Lookup field value Overwritten Original value
    Hi Sandeep,
     
    Can you tell us what Dynamics 365 application this question is related to? There are several different solutions in the Dynamics 365 family, like: Sales, Finance, Supply Chain Management, Project Operations, and Business Central. 
  • sandeepc Profile Picture
    5,388 on at
    Lookup field value Overwritten Original value
    .

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 294,261 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 233,017 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Product updates

Dynamics 365 release plans