Hey all, I'm having an issue creating and committing mxobjects within my javascript snippet. If i create an object, then commit it with these functions: 1.)
mx.data.create({
entity: "MyFirstModule.Score",
callback: function(obj) {
console.log("Object created on server");
tempMxobj = obj;
gameId = "" + obj["_guid"];
gameObject = obj["jsonData"];
},
error: function(e) {
console.log("an error occured: " + e);
}
}); 2.)
mx.data.commit({
mxobj: tempMxobj,
callback: function(mxobj) {
console.log("Object committed: " + mxobj);
},
error: function(e) {
console.log("Error occurred attempting to commit: " + e);
}
}); I don't have any issues. However, when I try to alter the newly created object in anyway and then commit it, I get an HTTP 560 error. Here is the code I'm using: 1.)
tempMxobj["jsonData"]["attributes"]["Points"] = "3";
mx.data.commit({
mxobj: tempMxobj,
callback: function(mxobj) {
console.log("Object committed: " + mxobj);
},
error: function(e) {
console.log("Error occurred attempting to commit: " + e);
}
}); *I have tried changing the the "3" to 3 to see if the error is due to the variable type. It doesn't affect the result* *Also I have tried to use the tempMxobj.set("Points", 3) function and that doesn't seem to change anything* And finally, here is the HTTP request payload for the commit: 1.)
{"action":"commit","params":{"guids":["6755399441059155"]},"changes":{},"objects":[{"objectType":"MyFirstModule.Score","guid":"6755399441059155","hash":"S9qEmClnHhLez63bFEGiUEASV+gWMPr3ztAEAX4XHdA=","attributes":{"Points":"3"}}],"context":[],"profiledata":{"1511371020510-7":10}} If anyone can point me in the right direction to resolve this issue I would really appreciate it. This feature isn't big enough to develop a fully fledged widget so I'd like to try to build this out in the Javascript/HTML snippet.
↧