Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 79901

OrganizationServiceContext AddRelatedObject exception

$
0
0

Hi,

I have a workflow that creates a new 'quote' entity and updates the 'product' entity N:1 relationship to this new quote.

Example is:

my_quote quote = new my_quote() // this is populated but won't bother showing the code

context.AddRelatedObject(product, new Relationship("my_quote_product), quote);

context.UpdateObject(product);

context.SaveChanges();

When I attempt to run this it throws an error saying no quote exists with Id xxxx-xxx-xxxx-xxxx (this is a proper guid, not an empty one). Surely if it's assigned it an Id then the entity must exist? 

This works in other environments so not too sure what the issue is.

Thanks
Alex


Viewing all articles
Browse latest Browse all 79901


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>