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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Upsert request with related entities Error

(0) ShareShare
ReportReport
Posted on by

Hi, all.

I am using MS Dynamics CRM 2016 On-Premises.
I am loading data through OrganizationService, using Upsert request.

And I am getting an error "Entity Id must be specified for Update".
As I understood - related Campagin ([0] in RelatedEntities on screen) record does not exist and should be created during upsert, and wave record should be updated.
But there isn't

What am I doing wrong?
Thank you for advices.

With regards, Yuriy.

*This post is locked for comments

I have the same question (0)
  • Verified answer
    David Jennaway Profile Picture
    14,065 on at

    I think the problem is that the Upsert only applies for the parent entity - i.e. the parent entity is either updated or created based on whether it already exists. If a update is determined for the parent entity, then the same operation is applied to the related entities - i.e. it will assume all related entities are to be updated.

    I think your only option is to submit 2 upsert requests - one for the parent entity, and another for the child entities, and to not to use related entities. You may also need a create request for all new child records of an existing parent entity

  • Community Member Profile Picture
    on at

    Hi, David.

    Thank you for your answer.

    I thought about two different requests, but those requests should go in single transaction. And I have no ideas how to set the relations in this situation - when one entity exists, and other doesn't exist, and I still dont know it's Id.

    With regards, Yuriy.

  • Community Member Profile Picture
    on at

    The main objective is, what I am trying to do - to load into CRM some linked records in single transaction, using ExecuteTransactionRequest. Some of records could be new and some of them could already be created in CRM.
    But there is a problem in setting relationships with entitites which are created but still aren't commited in current transaction.

    Is there any beautiful way to realise it?)

  • Suggested answer
    sandeepstw Profile Picture
    4,601 on at

    Hi,

    Related entities have not value for attribute id, either remove it or add Id for related entities. It will work. 

    Thanks,

    Sandeep

  • Verified answer
    Community Member Profile Picture
    on at

    It didnt work for me when I set the entity with key attributes as related entity,but it works with the relations should be set as new EntityReference("entity", "key_attr_name",key_attr_value).

    I successfully used separate query for each entity with references in single transaction in this way.

    Thank you very much.

  • nozd Profile Picture
    30 on at

    Hi!

    Could You show example of your code for single transaction?

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans