Hello,
We're using CRM 2013 on-premise and our requirements are as follow:
1. When a quote is activated, create a new custom entity 'Request'
2. Associate the quote with the new Request entity
3. Associate the new Request entity with all of the Quote Products from the Quote.
I got #1 and #2 working successfully.
However when I try to associate the newly created Request entity with quotedetail I got this error message: "The detail cannot be updated because the parent is not editable".
Does it mean that it's not possible to attach quotedetail into any other entities?
This is my code:
var quoteProducts = service.RetrieveMultiple(new FetchExpression(string.Format(RetrieveQuoteProducts, requestId)));
if (quoteProducts != null && quoteProducts.Entities.Count >= 1)
{
foreach (Entity product in quoteProducts.Entities)
{
var productId = product.Id;
var productRequestReferenceCollection = new EntityReferenceCollection();
var productRequestRelatedEntity = new EntityReference
{
Id = productId,
LogicalName = "quotedetail"
};
productRequestReferenceCollection.Add(productRequestRelatedEntity);
var productRequestReferenceCollectionRelRelationship = new Relationship
{
SchemaName = Schema.QuoteProduct.ContractProductRelationship
};
service.Associate("new_Request", RequestId, productRequestReferenceCollectionRelRelationship, productRequestReferenceCollection);
}
}
Thanks much.
-tri