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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Java script to Compare two different fields of two different entities

(0) ShareShare
ReportReport
Posted on by

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

I have the same question (0)
  • Suggested answer
    Community Member Profile Picture
    on at

    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

  • Suggested answer
    Jasdeep Singh Profile Picture
    62 on at

    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

  • Community Member Profile Picture
    on at

    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
    Rawish Kumar Profile Picture
    13,758 on at

    Hi Manikanta,

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

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans