web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested Answer

I Need Emailaddress1 and 2 check if exists or not in Contact entity using plugin in D365 with Plugin code and Registration Steps

(0) ShareShare
ReportReport
Posted on by 95

Hi team,

My request : Emailaddress1 and 2 check if exists or not in Contact entity using plugin.only

if i update/create the emailAddress1 value the plugin Check if exists or not in Contact entity.

if i update/create the emailAddress2 value the plugin Check if exists or not in Contact entity.

I need code and plugin Registration steps also.

Thanks

Saravanan 

I have the same question (0)
  • Suggested answer
    Bipin D365 Profile Picture
    28,985 Moderator on at

    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.

  • Suggested answer
    LeoAlt Profile Picture
    16,331 Moderator on at

    Hi partner,

    1.You could use FetchExpression or QueryExpression to check if the emailaddress you update/create is existed in contact.

    Sample code here:https://docs.microsoft.com/en-us/powerapps/developer/common-data-service/org-service/entity-operations-query-data

    2.Since you want to check it when creating or updating the record, you should register the step in 2 event. One is Create and other is Update, post and pre are all appropriate.

    First you should connect to your D365 environment.

    Then create a new Assembly with you plug-in dll file.

    pastedimage1596618815820v1.png

    Next create steps below the Assembly to choose the trigger event and entity.

    pastedimage1596618903345v2.png

    You could refer to the following links for more details.

    https://docs.microsoft.com/en-us/powerapps/developer/common-data-service/tutorial-write-plug-in#register-plug-in

    https://docs.microsoft.com/en-us/dynamics365/customerengagement/on-premises/developer/register-deploy-plugins

    Best Regards,

    Leo

  • sars Profile Picture
    95 on at

    Hi ,

    Thanks for your reply,

    If we have use any images inside the plugin and register the plugin.

    Thanks

    Saravanan

  • Suggested answer
    Bipin D365 Profile Picture
    28,985 Moderator on at

    Hi,

    For update message steps you can add pre-image to get the data if one of the Email Address is not updated.

    Say User has only updated Email Address 1 then in context you will get this field data. However Email Address 2 field will not be there in context as this is not updated by the used. in this  you need to use pre-image to get the field data.

    Logic -

    First check if field contains in context and not null

          Get Field Data

    Else if Check field and null in pre-image

          Get field data

    If found helpful, Please mark my answer verified.

  • sars Profile Picture
    95 on at

    Hi ,

    Thanks for your reply

    Can you please help me, am not understand the above code so please write full code and plugin registration steps.Its very urgent .

    Thanks

    Saravanan

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Muhammad Shahzad Shafique Profile Picture

Muhammad Shahzad Sh... 69 Most Valuable Professional

#2
ManoVerse Profile Picture

ManoVerse 55 Super User 2026 Season 1

#3
11manish Profile Picture

11manish 37

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans