Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Populate Lookup Field via Web API

(0) ShareShare
ReportReport
Posted on by 1,797

Hi, 

First time attempting to push data to Dynamics 365 programmatically via the Web API. I need a little help with populating lookup fields. 

If I have the GUID available this isn't an issue. The following POST creates a new lead with the Currency set to Euro. 

{
"subject" : "newlead3",
"transactioncurrencyid@odata.bind" : "/transactioncurrencies(2817303a-a84c-e811-8102-3863bb341bf8)"
}

How can I achieve this if I don't have the GUID available, and my source data only contains the string value EUR? I imagine I need to lookup the isocurrencycode from the associated transactioncurrency entity and when a match is found return the GUID for the matched Record. Is this correct?

*This post is locked for comments

  • JDMCRM Profile Picture
    JDMCRM 1,797 on at
    RE: Populate Lookup Field via Web API

    Great, thanks for the help. That does what I'm after :).

  • Verified answer
    Andreas Cieslik Profile Picture
    Andreas Cieslik 9,267 on at
    RE: Populate Lookup Field via Web API

    /api/data/v8.2/transactioncurrencies?$select=currencyname,isocurrencycode&$filter=contains(currencyname,'Euro')

    Results in:

    {

     "@odata.context":"crm365.domain.dev/.../v8.2$metadata#transactioncurrencies(currencyname,isocurrencycode)","value":[

       {

         "@odata.etag":"W/\"361185\"","currencyname":"Euro","isocurrencycode":"EUR","transactioncurrencyid":"695a881a-7a4f-e811-910d-00155dd55305"

       }

     ]

    }

    which includes the required guid field

  • JDMCRM Profile Picture
    JDMCRM 1,797 on at
    RE: Populate Lookup Field via Web API

    Hi Andreas, thanks for the response. Is there an example of how this can be achieved? I'm testing using Postman.

  • Suggested answer
    Andreas Cieslik Profile Picture
    Andreas Cieslik 9,267 on at
    RE: Populate Lookup Field via Web API

    Yes, it is correct. You cannot set currency only by it's name. As you wrote you need to fetch the guid of it first.

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,489 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,305 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans