Reputation: 1
I have a scenario, in Microsoft Dynamics 365 CRM: I am writing the plugin code for Quote Line, where I have a Quote
that consists of multiple QuoteLine
records. Whenever the Quote
is revised, the system creates a new Quote
along with new QuoteLine
records.
Whenever a new QuoteLine
is created, I need to store the GUID of the corresponding parent QuoteLine
in the custom field RevisionOrigin
of the newly created QuoteLine
.
How can I achieve this functionality to link the new QuoteLine
in the revised quote with its original parent QuoteLine
?
I have used the ParentContext
functionality, but it is returning the GUID of the parent QuoteId
instead of the QuoteDetailId
.
IPluginExecutionContext parentContext = _context.ParentContext.ParentContext;
if (parentContext.InputParameters.Contains("QuoteDetailId"))
{
Guid revisedQuoteLineId = (Guid)parentContext.InputParameters["QuoteDetailId"];
entity[RevisionOrigin] = revisedQuoteLineId;
service.Update(entity);
}
Upvotes: 0
Views: 22