Skip to main content
New Participant
Nov 10, 2022 11:01 AM UTC
Question

How to add a new entry into table using a!writeRecords?

Hi,

I am trying to use a!writeRecord function in an interface button save into block. Below is my code. Id is a Primary Key and is set as AUTO_INCREMENT in the database table. When I set the id as 0, it doesn't seem to accept the identifier and hence fails. What should I do in order to write a new entry into the table using this function?

PS : I am able to update the record and the corresponding row in the DB with an existing identifier.

11 replies

stefanhelzle0001
Brainy
Nov 10, 2022 12:25 PM UTC

Leave the id empty or null.

New Participant
Nov 10, 2022 12:30 PM UTC

I tried setting id as null or "", it still doesn't work. I tried commenting out the id line all together but no luck.

Employee
Nov 10, 2022 1:34 PM UTC

If it really is an auto-increment primary key, you don't need to include the id field at all.  Also, is this an action on a button?  docs.appian.com/.../executing_smart_services.html