This question is locked. New answers and comments are not allowed.
Hi,
I'm working on a scheme where one user can add a record to a TBS content type, and assign ownership of that record to a different user. Using the .net sdk, I tried to set the owner and/or ACL in the request, but found that they are ignored. Rather than make two round trips, I decided to move the reassignment of ownership into the cloud code, like this:
This actually works, but I don't like the looks of that request.data._id field. That's the only place I could see the record Id of the new record in the console log. It seems as though the new record id should be somewhere inside the response, not the request, no? I can't find documentation describing the cloud code arguments, so can you please tell me the best way to do this? Also, why is specifying the owner or ACL when creating a record disallowed? (or am I just doing it incorrectly...?)
Thank you,
Kelly
I'm working on a scheme where one user can add a record to a TBS content type, and assign ownership of that record to a different user. Using the .net sdk, I tried to set the owner and/or ACL in the request, but found that they are ignored. Rather than make two round trips, I decided to move the reassignment of ownership into the cloud code, like this:
Everlive.Events.afterCreate(
function
(request, response, context, done) {
if
(!response.error)
{
var
id = request.data._id;
var
owner = request.data.NewOwner;
Everlive.Sdk.withMasterKey().data(
'Blah'
).setOwner(owner, id);
console.log(
"Changed "
+ id +
" owner to "
+ owner);
}
done();
});
This actually works, but I don't like the looks of that request.data._id field. That's the only place I could see the record Id of the new record in the console log. It seems as though the new record id should be somewhere inside the response, not the request, no? I can't find documentation describing the cloud code arguments, so can you please tell me the best way to do this? Also, why is specifying the owner or ACL when creating a record disallowed? (or am I just doing it incorrectly...?)
Thank you,
Kelly