Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

How to update a field by fetching data from other entity by passing 2 keys

(0) ShareShare
ReportReport
Posted on by 435

Hi Folks, 

Please advice me in a current scenario--

In a form Inquiry (custom Entity)

I have fields- Products ,Region ,ShppingLocation
Also - Product and Region are separate Entity which is linked with Inquiry Entity.

Now I have one more entity - ShippingEntity 
Which have fields - Products,Region ,ShippingPoint
Data --     Products      Region      ShippingPoint
                   Pen            Asia                    China
                   Mobile      Asia                     China
                  TV              Asia                      Seoul
                  Aircaft       Europe                  Paris
                 Camera      North America      USA

Now In Inquiry Form --
When Inquiry Is created its contains some field along with Product eg - Pen , Mobile, TV but Region is always remains blank.
Now if any one select Region of Inquiry entity (which will be a optional filed) then automatic  Shipping location  should get set in this Inquiry location 

So if In Inquiry if Product set to - Mobile
and Region selected is Asia then Shipping location should set -- China     ------ And this information we need to fetch from  ShippingEntity

So we if we pass two key Product and Region to this entity then we can get its  ShippingPoint 

How I can achive this ? Can I go for javsacript or any other way to do ?

Thanks

*This post is locked for comments

  • Suggested answer
    RaviKashyap Profile Picture
    RaviKashyap 55,410 on at
    RE: How to update a field by fetching data from other entity by passing 2 keys

    Hi,

    The query parematers depend supon teh data type i.e. if it is simple text then you can write the text but if it is a lookup then you need to pass the guid. The easiest way to write a wuery if to use the CRM Rest Builder tool. This will not only generate the query, it cann also execute it and show you the results so that you can change it according to your needs.

    www.toplinestrategies.com/.../crm-rest-builder-useful-tool-working-crm-2016’s-web-api

    You can download the tool here- github.com/.../releases

  • windyMill Profile Picture
    windyMill 435 on at
    RE: How to update a field by fetching data from other entity by passing 2 keys

    Hi Ravi ,

    Can you please let me  know in below crm  entity( ShippingEntity)  if  want to pass 2 key like Pen & Asia then  can I get  Shippoint point as - China.

                     Products      Region      ShippingPoint

                      Pen            Asia                    China

                      Mobile      Asia                     China

                     TV              Asia                      Seoul

                     Aircaft       Europe                  Paris

                    Camera      North America      USA

    And what will be the correct oDataquery for this  i tried this one -

    var selectQuery = "/ShippingEntity?&$filter=xxx_products eq '" + mylocalVar_Product+ "'  and  xxx_Region eq   '" + mylocalVar_Region+ "'      &$select=xxx_ShippingPoint";

    I am using schema name .

    Can you please correct my query  or any suggestion ?

    Thanks

  • windyMill Profile Picture
    windyMill 435 on at
    RE: How to update a field by fetching data from other entity by passing 2 keys

    Thanks Ravi.

    I will try to implement the code given by you in yiur above reply.

  • RE: How to update a field by fetching data from other entity by passing 2 keys

    yes on change of region you can fire javascript and fetch shipping point using products and region lookup values.As suggested by ravi you can go for Web Api retrieve call and there should be some relationship between shipping point and products / region.

  • Verified answer
    RaviKashyap Profile Picture
    RaviKashyap 55,410 on at
    RE: How to update a field by fetching data from other entity by passing 2 keys

    Hi,

    You need to use JavaScript/ Web API query to retrieve the details. Please refer the below blog-

    community.dynamics.com/.../how-to-retrieve-lookup-value-and-set-it-on-another-lookup-field-in-dynamics-crm-JavaScript

    To build web api queirs, you can download & use Rest Builder tool.

    Hope this helps.

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

Announcing Our 2025 Season 1 Super Users!

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

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,375 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans