dynamics-crmdynamics-crm-2011crmdynamics-crm-2013dynamics-crm-online

Update a existing record instead of creating new record of same entity in MS CRM


I have work order product entity which have product, status and quantity field in MS CRM online. When user tries to create a new record of work order product entity, quantity of existing work order product record with same product should be increased instead of creating new work order product record (without letting user know). Can anyone explain how to achieve this requirement ? This should work for creating record by form or by data import/export.


Solution

  • You must write a plugin in the creation event (post operation) of the order product. In this plugin you need to check if you have another ordering product with the same product. If so, you must increase the quantity of your existing product order and delete the new one. If you want to have a good user experience, you can send an alert to your user to inform them of this logic when creating a new order product with the same product as that of an old one.