Skip to main content

Notifications

Announcements

No record found.

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

  • Vallamreddy VenuGopal Profile Picture
    80 on at
    RE: Unable to update "Choose Product" field on Opportunity Product line form

    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

  • Suggested answer
    Nya Profile Picture
    29,058 on at
    RE: Unable to update "Choose Product" field on Opportunity Product line form

    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

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February 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... 293,027 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,852 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Product updates

Dynamics 365 release plans