Microsoft Dynamics 365 is a treasure box which includes Sales, Service, Settings and so on. In this blog, we are going to explorer one of the valuable piece in this treasure box which named as Product.
So this is something about the OOB “CLONE” button on Product entity, which ease our job by making clone of same product and saving our time to re-filling same details for newly created product record. Just click on “CLONE” and we have mirror product with additional suffix in “Name (name)” of product and auto generated “Product ID (product number)”.
Recently had one business requirement, to send email when product record is cloned, and keep Created by of Cloned product in “TO”. So to set up this we created on Real Time workflow which sends email on create of Product entity record.
Whenever we are cloning Product the workflow is triggering but emails were not generating and failing due to error “Object address not found on party or party is marked as non-emailable ”and after further investigation we came across further questions and got the resolution.
1. What happens with Created By and Modified By when we create Product?
Answer is, of course the user who created product record should set as Created By and Modified By.
2. Now the question is, what happens when you CLONE the product and what values set as Created by and Modified by?
Answer is, Created by set as System and Modified by set as System.
3. So where is the current logged in user, who CLONED the product record?
And here is the answer, Created by (Delegate) and Modified by (Delegate) set as user who cloned the product record.
We tweak workflow by checking if the Created By (Delegate) contains data it means it is Cloned and set same in To property of Email step, otherwise set only Created By in To (i.e. Product is created and cloned) and It resolved the issue.
The reason was System user doesn’t have email address and we cannot update the record.
Created by (Delegate) and Modified by (Delegate) set as user who has been cloned the product record.