When I press "revise" button, original quote is getting closed and a new quote, with state "draft" is being created. I'm getting redirected to newly created quote, however, one of my custom field is not getting copied. How to make it copy?
Right now, I created a plugin on pre-create Quote event, and the code is:
var parentContext = this.CrmServiceProvider.Context.ParentContext;
if (parentContext != null &&
parentContext.PrimaryEntityId != null &&
this.Entity.Contains(Quote.RevisionNumber_AttrName) &&
(this.Entity.RevisionNumber ?? 0) > 0)
{
QuoteBO firstQuote = new QuoteBO(this.CrmServiceProvider, new EntityReference(Quote.EntityLogicalName, parentContext.PrimaryEntityId));
if (firstQuote != null && firstQuote.Entity.ntw_PaymentTerms != null)
{
// trying to copy from closed quote to new, draft quote
this.Entity.ntw_PaymentTerms = firstQuote.Entity.ntw_PaymentTerms;
}
}
However, this does not work.parentContext.PrimaryEntityIdis not null, but it's guid equals {0000-0000-0000-0000}.






