1

I Have a Subgrid in Quote entity, in which there are records of my custom entity, And also the custom entity display in left side of the form,Because the custom entity has N:1 relation with quote. Every Quote can have many of my custom entitiey records. It is ok,But when I revise the Quote, I want the same data and records of previous subgrid display in the new quote subgrid, as well as other fields that copy and appear from the previous subgrid. How can I do that? Any Idea?

Alireza
  • 179
  • 1
  • 2
  • 11

1 Answers1

0

When you create a revised quote through the UI, a new quote is created behind the scenes. You can thus create a plugin that listens for the Create eventoperation for Quote. In this plugin you can retrieve the original quote and clone the relationships between your custom entity and quote.

In the plugin you can check the value of the revisionnumber attribute to see if the quote in question is a revised quote.

Subsequently you can look in the ParentContext for the QuoteId value from the ReviseQuoteRequest to get the guid of the quote that the clone was initiated from. See Catch the Revise Quote message inside a Plugin for an example of this.

You mention that the relationship from your custom entity to Quote is N:1. In this case you would need to either clone the custom records, or change the relationship to be N:N.

Henrik H
  • 5,747
  • 1
  • 21
  • 33