Showing results for 
Search instead for 
Did you mean: 

How to create a new record using ODataModel?

Former Member
0 Kudos


I am new to UI5 and so ODataModel. I have tied one table to an ODataModel.

How would I send request to a server so that I will have a new entry created at server end?

I googled this and I tried following:

1. Called createEntry method on ODataModel as follows:











2. I called then submitChanges method on the model as follows:


This is giving error as follows:

  1. POST 403 (Forbidden) datajs.js:17
  2. 2014-06-05 16:53:32 The following problem occurred: HTTP request failed403,Forbidden,CSRF token validation failed -

When I try to use ajax call instead of these methods, I get error as follows:

var obj={

  "Childbp": "C5192081",

  "ChildbpName": "Supriya Kale",

  "DeUser": "C5192081",

  "Id": "8",

  "Parentbp": "I0656568",

  "ParentbpName": "",

  "RelationType": "RESOURCE MANAGER",

  "SeqNo": "1",








  type: "PUT",

  dataType: "json",

  url: "",

  data: JSON.stringify(obj)

  }).success(function( msg ) {

  alert('HI read operation complete....................................');


  alert("error occurred");


  1. I get following error:

  2. PUT 403 (Forbidden)

Can anyone tell me if I am going wrong in calling methods? Help would be appreciated.


Supriya Kale

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Supriya,

try to call this function before submitChanges()




Former Member
0 Kudos

Hi Peter,

Thanks for the reply. Can you please paste here some snippet which would be saving data(inserting a new record) in ODataModel? This will be very much helpful.


Supriya Kale

Former Member
0 Kudos

Hi Supriya,

you can take a look at this blog.

Scroll down to Create Operation.

There you can see that the author is also first fetching CSRF and the calling CREATE operation.

For simple example see correct answer in this thread.

Best regards,


Answers (0)