Cannot save new item in JS, Entity with the specified ID cannot be found: Id

I am having an issue creating new items while I still can Update and remove existing items

when I tested creating new item on console I got this error
Entity with the specified ID cannot be found: Id

this is the link that I am working on (The links are live with the client):
https://api.backendless.com/CBB64460-4CC0-246F-FF35-EF09F6298800/v1/files/Ejadah-Confex/Ejadah-Confex/sponsor-categories.html

This is the SponsorCategories class



function SponsorCategories() {
	this.objectId = "";
	this.name = "";
}

preparing data

var data = new SponsorCategories() ; 
data.name = "test";

Saving data

Backendless.Persistence.of(SponsorCategories).save(data)

Error

PUT https://api.backendless.com/v1/data/SponsorCategories 403 (Forbidden)
Uncaught Object {code: 1000, message: "Entity with the specified ID cannot be found: Id - ", statusCode: 403}

I’ve tested creating new uuid using this method
https://gist.github.com/1308368

var Utils = {
	// https://gist.github.com/1308368
	uuid: function (a, b) {
		for (b = a = ''; a++ < 36; b += a * 51 & 52 ? (a ^ 15 ? 8 ^ Math.random() * (a ^ 20 ? 16 : 4) : 4).toString(16) : '-');
		return b
	},
	pluralize: function (count, word) {
		return count === 1 ? word : word + 's';
	}
};

and now I get this error

Uncaught Object {code: 1000, message: "Entity with the specified ID cannot be found: Id - b1d9bedd-53ff-42b1-a3ad-7f505b999c5f", statusCode: 403}

Hi Ahmed,
try to not specify the objectId when creating new item.

Stanislav

That’s what I did before I didn’t set the objectId at first Only the name column

var data = new SponsorCategories() ;
data.name = "test";

I’ve commented the objectId from table structure yet I am getting the same error

function SponsorCategories() {
//this.objectId = "";
this.name = "";
}

Do you have any required columns in your SponsorCategories table? Maybe you set NN to some column. If yes, then you have to specify value for this column also.

I only have 1 column ‘name’http://support.backendless.com/public/attachments/c9bd3bb4fc3f1552edd94d3d63b96914.png&lt;/img&gt;

I did nothing to the code on all platforms it was working fine and the client had created multiple data before

actually my issue is related to similar issue that was asked by others before on ios and android. But I am using JS. the application on android and ios is working fine this issue appeared only on ios

other topics similar to my issue
http://support.backendless.com/t/cant-save-data-anymore
http://support.backendless.com/t/cannot-save-new-data-objects
http://support.backendless.com/t/entity-with-the-specified-id-cannot-be-found-id-missing-id

I did not notice that you comment out this line. Once I did that, it seems, everything is working as it should. Please confirm if I don’t mistake.

Regards,
Stanislav

everything is working but creating new row

This is my code, based on the todo list example

sponsor-categories.js.txt (24.47kB)

Sorry, would like to clarify. Saying “create new row” do you mean create New Sponsor Category in your app? If so, I just checked again right in your project by this link:

https://api.backendless.com/CBB64460-4CC0-246F-FF35-EF09F6298800/v1/files/Ejadah-Confex/Ejadah-Confex/sponsor-categories.html
And have successfully created new sponsor category. Is it what you need?

that’s weird!!

I did nothing to the code on the server at all even the objectid I commented this line on localhost

it’s working fine with SponsorCategories but it doesn’t create new item on other classes everything was working before a month and the client just inserted the data from the front-end that I provided.

what do you think was the problem

check the other links I cannot add new items to the tables
http://localhost/Projects/GoogleDrive/Code-Projects/Web/_WORK/GISTIC/Ejadah-confex/Ejadah-Confex/event-categories.html?
http://localhost/Projects/GoogleDrive/Code-Projects/Web/_WORK/GISTIC/Ejadah-confex/Ejadah-Confex/registered-users.html

and all the links on the header

As I mentioned before, the when you create new object (or records), the initial value of objectId should not be an empty string. The objectId field should not present at all when creating new object. I’ve fixed that in your app on server. Please, try again and let me know if you encounter the same problem again.

Regards,
Stanislav