Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM forum
Suggested answer

How to compare given email value using JavaScript

Posted on by 340

Hi Guys

I want to compare the given "to" email ID (e.g. test1@gmail.com) on Email form with set of two email ID's (e.g. test2@gmail.com && test3@gmail.com) . How can this be achieved using Javascript.

set 1 = "test2@gmail.com"," test3@gmail.com".

check in if condition

if(set1.has(test1@gamil.com)

{

}

else

{

}

  • Suggested answer
    Abdul Wahab Profile Picture
    Abdul Wahab 12,070 Moderator on at
    RE: How to compare given email value using JavaScript

    Hello Sandy Hello

    Your code should look like the below:

    let to = "test1@gmail.com";
    let text = "test2@gmail.com,test3@gmail.com";
    const myArray = text.split(",");
    for (let i = 0; i < myArray.length; i  ) {
      if(to === myArray[i]){
      console.log("Test");
      }
    } 

    Let me know if I can provide you with more details.

    Thanks
    Regards,

    Abdul Wahab
    Power Platform/Customer Engagement Developer/Lead/Solution Architecture/Project Manager
    Direct/WhatsApp: 923323281237
    E-mail: abdulwahabubit@outlook.com
    Skype: abdul.wahabubit
    Linkedin: www.linkedin.com/.../

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

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,556 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,625 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans