Could this be a security issue? Have you checked there are permissions to create the entity and set the attributes?
I’ve not been able to recreate the issue you’re seeing. The following works for me.
I created a blank app in 7.22.2, added a module “ContactUs”, with an Entity “Service”, with an attribute “Name”. I also created overview pages to see what was going on.
The following JavaScript run in a console successfully creates a new Service entity with the Name attribute set to “Rob”.
mx.data.create({
entity: "ContactUs.Service",
callback: function(obj) {
console.log("Object created on server", obj);
obj.set("Name", "Rob");
mx.data.commit({
mxobj: obj,
callback: function() {
console.log("Object committed");
},
error: function(e) {
console.log("Could not commit object: ", e);
}
});
},
error: function(e) {
console.error("Could not commit object:", e);
}
});
I can see this entity show up correctly in the Overview pages.
I can also retrieve it using it’s GUID (found by watching the console on the Overview page load).
mx.data.get({
guid: "6755399441055745",
callback: function(obj) {
console.log("Received MxObject with GUID " + obj.getGuid());
}
});
Hope this helps.