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 :
Customer experience | Sales, Customer Insights,...
Answered

Create a relationship and update via the web api.

(0) ShareShare
ReportReport
Posted on by 25

Hi All,

I have created a custom entity called interactions, and then another called interactiondata. I then created a relationship between them where an interaction can have many interaction datas.

I can create an interaction entity using the WebAPI and that works as expected, but when I come to create an interactiondata with a relation to the interaction, it all blows up. I suspect I am getting the odata.bind name incorrect.

I was wondering if there is an easy way to identify what that name should be.

I tried this:

```

"tk_interactionid@odata.bind""/tk_interactions(391dd6ed-5ed3-eb11-bacb-0022481aaac7)"
```
But this did not work and gives me an error:
```
An error occurred while validating input parameters: Microsoft.OData.ODataException: An undeclared property 'tk_interactionid' which only has property annotations in the payload but no property value was found in the payload. In OData, only declared navigation properties and declared named streams can be represented as properties without values.\r\n   at Microsoft.OData.JsonLight.ODataJsonLightResourceDeserializer.ReadUndeclaredProperty(IODataJsonLightReaderResourceState resourceState, String propertyName, Boolean propertyWithValue)\r\n   at Microsoft.OData.JsonLight.ODataJsonLightResourceDeserializer.ReadPropertyWithoutValue(IODataJsonLightReaderResourceState resourceState, String propertyName)\r\n   at Microsoft.OData.JsonLight.ODataJsonLightResourceDeserializer.<>c__DisplayClass9_0.<ReadResourceContent>b__0(PropertyParsingResult propertyParsingResult, String propertyName)\r\n   at Microsoft.OData.JsonLight.ODataJsonLightDeserializer.ProcessProperty(PropertyAndAnnotationCollector propertyAndAnnotationCollector, Func`2 readPropertyAnnotationValue, Action`2 handleProperty)\r\n   at Microsoft.OData.JsonLight.ODataJsonLightResourceDeserializer.ReadResourceContent(IODataJsonLightReaderResourceState resourceState)\r\n   at Microsoft.OData.JsonLight.ODataJsonLightReader.StartReadingResource()\r\n   at Microsoft.OData.JsonLight.ODataJsonLightReader.ReadResourceSetItemStart(PropertyAndAnnotationCollector propertyAndAnnotationCollector, SelectedPropertiesNode selectedProperties)\r\n   at Microsoft.OData.JsonLight.ODataJsonLightReader.ReadAtStartImplementationSynchronously(PropertyAndAnnotationCollector propertyAndAnnotationCollector)\r\n   at Microsoft.OData.ODataReaderCore.ReadImplementation()\r\n   at Microsoft.OData.ODataReaderCore.InterceptException[T](Func`1 action)\r\n   at System.Web.OData.Formatter.Deserialization.ODataReaderExtensions.ReadResourceOrResourceSet(ODataReader reader)\r\n   at System.Web.OData.Formatter.Deserialization.ODataResourceDeserializer.Read(ODataMessageReader messageReader, Type type, ODataDeserializerContext readContext)\r\n   at System.Web.OData.Formatter.ODataMediaTypeFormatter.ReadFromStream(Type type, Stream readStream, HttpContent content, IFormatterLogger formatterLogger)
```
Any thoughts or advice on this would be amazing!
I have the same question (0)
  • Verified answer
    meelamri Profile Picture
    13,216 User Group Leader on at

    Hi drewdan, 

    The easiest and straightforward way to generate your requests is to use the CRM Rest Builder tool. You can download the latest version of this solution here: https://github.com/jlattimer/CRMRESTBuilder/releases

    Example: 

    I want to update the parent customer for an account: 

    pastedimage1624525043688v2.png

    The generated code: 

    pastedimage1624525029758v1.png

    Good luck !

  • drewdan Profile Picture
    25 on at

    This looks amazing! Thank you for this, I will give it a go now!

  • meelamri Profile Picture
    13,216 User Group Leader on at

    Don't hesitate to keep up to date if it worked for you.

  • Suggested answer
    Charan Raju C R Profile Picture
    7 Moderator on at

    Hi drewdan,

    Lookup field tk_interactionid should be a schema name, check that.

  • drewdan Profile Picture
    25 on at

    It seems like the package does  not show the custom entities that I have created in the list of entities. Do you know if this is a limitation of the solution, or a configuration issue?

  • drewdan Profile Picture
    25 on at

    Hi Charan,

    This felt promising, but I still get an error:

    pastedimage1624526728926v1.png

    So I found this as the schema name, which I have changed in my postman request

    However, I still get an error:

    pastedimage1624526761928v2.png

    Could this be the lookup item itself which is incorrect?

    Andrew

  • drewdan Profile Picture
    25 on at

    Sorry Mehdi, I found the entities now, I was looking for their label and not their name, my mistake!

  • meelamri Profile Picture
    13,216 User Group Leader on at

    I cross my fingers for you

  • meelamri Profile Picture
    13,216 User Group Leader on at

    Any news ?

  • drewdan Profile Picture
    25 on at

    Hey Mehdi,

    Yup, turns out I had an error in my relationships, so as soon as I resolved them, I was able to use the code generated from that package, and it made it much easier to work out what I had to do. It did the trick perfectly. Thank you so much for your help and prompt response :)

    Andrew

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 > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 137 Super User 2025 Season 2

#2
#ManoVerse Profile Picture

#ManoVerse 57

#3
Jimmy Passeti Profile Picture

Jimmy Passeti 50 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans