RE: I Need Emailaddress1 and 2 check if exists or not in Contact entity using plugin in D365 with Plugin code and Registration Steps
Hi,
if i update/create the emailAddress1 and emailAddress2 value on which entity?
Plugin registration steps -
Message - create and update
Entity - ?
execution pipeline - pre-operation
Mode - sync
For update message - Select Email Address1 and Email Address2 in filtering attributes
Plugin Code-
Entity target =context.inputParameters["Target"] as Entity;
if(target.Attributes.Contains("Email address 1") && target["Email Adddress 1"]!=null)
{
//Use service.retrievemultiple to check if email address 1 is present in contact
//You can use query expression or fetch xml
//if count is >0 do whatever you need to do
}
if(target.Attributes.Contains("Email address 2") && target["Email Adddress 2"]!=null)
{
//Use service.retrievemultiple to check if email address 2 is present in contact
//You can use query expression or fetch xml
//if count is >0 do whatever you need to do
}
Sample code - docs.microsoft.com/.../plugin-development
If found helpful, Please mark my answer verified.