Create Record Action in outsystems

Create Record Action in outsystems

  

I am trying to insert/create a record in the table AM. But it gives me an exception as below,

"Violation of PRIMARY KEY constraint 'AM'. Cannot insert duplicate key in object 'dbo.AM'. The duplicate key value is (0). The statement has been terminated."


This issue is because in Assign block I am assigning a few values as below, but id of the record is 0 always and its therefore unable to create a record.







Solution

Hi Neha,

It seems that your "AM" Entity (terribly undescriptive name btw :)) doesn't have the "Is AutoNumber" Property of its Id set to "Yes", which means that on creating a record, you have to supply it with a unique Id yourself. Personally, I'd always opt to have an auto-number as Id, as this makes life much easier. Is there any reason why it isn't?

Solution