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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Suggested Answer

Unable to update "Choose Product" field on Opportunity Product line form

(0) ShareShare
ReportReport
Posted on by 80

Hi there,

One of our team member has wrongly mapped "Choose Product" field on opportunityproduct entity while importing the data. We realized it later and we are trying to update the field with actual Products from product entity. 

Here is the code that we are using to update the "choose product" field.

Entity entity = new Entity("opportunityproduct")
{
Id = new Guid(dr["(Do Not Modify) Opportunity Product"].ToString())
};
entity["productid"] = new EntityReference("product", new Guid(dr["productid"].ToString()));
_orgService.Update(entity);

But for some reason, we are getting "Entity Reference cannot have Id and Key Attributes empty" error. Below the stack trace.

System.ServiceModel.FaultException`1
HResult=0x80131501
Message=Entity Reference cannot have Id and Key Attributes empty.
Source=mscorlib
StackTrace:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at Microsoft.Xrm.Sdk.IOrganizationService.Update(Entity entity)
at Microsoft.Xrm.Sdk.WebServiceClient.OrganizationWebProxyClient.<>c__DisplayClass38_0.<UpdateCore>b__0()
at Microsoft.Xrm.Sdk.WebServiceClient.WebProxyClient`1.ExecuteAction(Action action)
at Microsoft.Xrm.Sdk.WebServiceClient.OrganizationWebProxyClient.UpdateCore(Entity entity)
at Microsoft.Xrm.Sdk.WebServiceClient.OrganizationWebProxyClient.Update(Entity entity)
at ConsoleApp2.Program.Main(String[] args) in C:\ConsoleApp2\Program.cs:line 28

Can somebody please help if i am doing anything wrong.

Thanks,

Venu

I have the same question (0)
  • Suggested answer
    Nya Profile Picture
    29,060 on at

    Hi Venu,

    Please refer to the answer in the following issue, which is similar to yours.

    (+) ID of an entity does not exist - Microsoft Dynamics CRM Forum Community Forum

  • Vallamreddy VenuGopal Profile Picture
    80 on at

    Thanks Nya for your response.

    My solution is not a Plugin Assembly, it's a console application. We have few records that needed to be updated to a new product and chose the way of console app to update these records. Means, in our case the record already exists and the error is completely different what the above thread discussed about.

    Regards,

    Venu

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

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

#1
Pallavi Phade Profile Picture

Pallavi Phade 102 Super User 2026 Season 1

#2
Abhilash Warrier Profile Picture

Abhilash Warrier 55 Super User 2026 Season 1

#3
ManoVerse Profile Picture

ManoVerse 53 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans