Skip to main content

Notifications

Microsoft Dynamics CRM (Archived)

Java script to Compare two different fields of two different entities

Posted on by Microsoft Employee

Hi 

  I am stuck with the problem . i have two entities A and  B and no relation between two entities and had a field called (Destination code)  which is single line  of text in 2 entities ,Now i want to compare the value of Destination codes in two different entities.if the value matches i want to update that  value to the lookup field in Entity B . i tried to do with workflow but it does not work for me ,so i am trying to do with java script .but don't know how to start ,Any suggestions would be helpful

Thanks 

*This post is locked for comments

  • Suggested answer
    Rawish Kumar Profile Picture
    Rawish Kumar 13,756 on at
    RE: Java script to Compare two different fields of two different entities

    Hi Manikanta,

    there was a similar question posted and i replied to it :community.dynamics.com/.../262740

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Java script to Compare two different fields of two different entities

    Hi!
     
    It seems like the business logic is not very clear. You normally should create relations for the entities to be able to compare. For requests you can use CRM RestBuilder or SDK.REST library.
     
    If you want to do it via JavaScript using SDK.REST lib try the following:
    1) For the required event to get a query for the entry you want to compare to the current one. Pull the value out of entity.
    2) Compare it with the current value from the current entity.
     

    Hope it helps

    Please mark it As Answered or Verified if it did help you.

    Thanks

    Vlad

    http://dynamicalabs.com/

  • Suggested answer
    Jasdeep Singh Profile Picture
    Jasdeep Singh 60 on at
    RE: Java script to Compare two different fields of two different entities

    Hi Manikanta,

    As you described, you need to compare destination code value in another entity,you can do this easily with window application utility:

    first to fetch all the records from entity A and get that destination code ,then make a fetch for entity B with filter condition on destination code, and pass destination code that get from entity A, if it match that destination code, then you have both Guid of entity A and entity B, so you can update the lookup values as you want, if not matched then it goes for next record to compare and update the lookup.

    Thanks

    Jasdeep singh

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Java script to Compare two different fields of two different entities

    Hi Manikanta ,

    it is not clear to me, please provide a full detailed example, like:

    1) I have an existant account record with Destination code AAA

    2) I create a new account record with Destination code AAA (or BBB)

    3) I would like to ... before/after create/update ... etc.

    Help us understand better your needs.

    Thanks.

    If you found the answer helpful, please mark as Verified 

    Join my network on LinkedIn      Follow me on Twitter 

    Thank You & Best Regards

    Francesco Picchi

    Microsoft Dynamics CRM Consultant, Bologna+Milano, ITALY

    Independent Contractor

    http://www.francescopicchi.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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,240 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans