Skip to main content

Notifications

Announcements

No record found.

Power Platform integration forum
Under review by Community Managers

Under review

Thank you for your post! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

How do I POST/PATCH data to dataverse lookup column?

Posted on by 5

I have a table in dataverse which has a lookup column. If I make a post without the lookup column, the data will be updated in the table, except of course the lookup column. My question is how do I update the lookup column as well? This is the script that I use


> > jsonlistdf = ['column1': '0000098778', 'lookupcolumn': '5187', 'column2': 'Lodon', 'column3': '8000'}
>
> conn = http.client.HTTPSConnection("{}.api.crm4.dynamics.com".format(url))
>
> headers = {
> 'Authorization': 'Bearer ' +accesstoken,
> 'OData-MaxVersion': '4.0',
> 'OData-Version': '4.0',
> 'Accept': 'application/json',
> 'Content-Type': 'application/json; charset=utf-8',
> 'Prefer': 'return=representation'
>
> }
>
> for i in jsonlistdf:
> data = json.dumps(i, default=str)
> response = conn.request("POST", "/api/data/v9.2/tablewithlookupcolumn", data, headers)
> res = conn.getresponse()
> data = res.read()
> print(res.status, res.reason)

I have understood that I need the GUID from the lookup table that the relationship has, but can't find any documentation how this should be done. 

Helpful resources

Quick Links

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans