Showing results for 
Search instead for 
Did you mean: 

SAPUI5: How to update a property which is the key for a navigation property.

0 Kudos

I'm using an ODATA V2 model in a SAP UI5 application.

The model contains e.g. a set named CAR and a set named COLOR. The CAR set contains a property colorId which is a 1:n navigation property to COLOR:

<NavigationProperty Name="ColorDetails" Relationship="TestApplication.Car_Color_Many_ZeroToOne0" FromRole="Car" ToRole="Color"/>

My UI5 contains a com boBox with all avaiable Colors so that I can ensure that the user cannot select a value for COLOR which is not in the COLOR set.

When I now send an PUT request to the ODATA services all properties are updated except the property colorId.

Can somebody help me or provide me with an example. Thank you ...

Accepted Solutions (0)

Answers (2)

Answers (2)

0 Kudos

carcolormodel2.jpgI'm triggering the PUT request to http://{servername}/TestApplication/data.svc/Cars(1) where 1 is the ID from CAR entity.

What I want to do is, I just want to update the CAR entity with a new COLOR_ID: The existing car is no longer a red car, it should be updated to a green car.


Attached also a screenshot from the PUT request trying to update the Car with Id = 1. The carlocation and description is updated. The colorId seems to be ignored and is not updated on the database.

0 Kudos

Hi ...

Any Error you are getting from the service when you try to PUT the colorId ?? ..Check the console of the browser for the error .. If not than can you test your PUT method of the service from POSTMAN, this way you can determine if the error is from backend or front end ..

Let me know your findings on this ... this way we can now where to fix this either on frontend or backend



Active Contributor
0 Kudos

On which entity are you triggering PUT . URL please.

Put request is an update request and in update request we cannot change the key fields. Here I assume Color_Id is key field.