[AC-3598] Relation fields in ArrowDB Appcelerator and File objects
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Closed |
Resolution | Needs more info |
Resolution Date | 2016-05-17T14:02:15.000+0000 |
Affected Version/s | Appcelerator Studio 4.5.0 |
Fix Version/s | n/a |
Components | ArrowDB |
Labels | n/a |
Reporter | Jan Frode Maurice |
Assignee | Shak Hossain |
Created | 2016-05-05T17:29:18.000+0000 |
Updated | 2016-05-17T14:02:15.000+0000 |
Description
I'm adding a User object as an relation field to a Message object, and that works fine. But when I try to add an relation to a File object from the same Message object I get the following error:
400: Failed to send message: Invalid ACS type: file
Maybe I'm using the wrong notation for the File object!? I've tried: [ACS_File], [ACS_Files] without any luck?....[ACS_User] works like a charm?
Here is my code:
Cloud.Messages.create({
to_ids: to.join(','),
body: 'New Message',
subject: 'Test Message',
custom_fields:
{
"[ACS_File]file_id":videoFile, //videoFile is an Id string
"[ACS_User]owner_id":to.join(','),
"pausedAt" : pausedAt,
"correctAnswer": correctAnswer,
"a2" : a2,
"a3" : a3
}
}, function (e) {
if (e.success) {
var message = e.messages[0];
alert('Success:\n' +
'id: ' + message.id + '\n' +
'subject: ' + message.subject + '\n' +
'body: ' + message.body + '\n' +
'updated_at: ' + message.updated_at);
} else {
alert('Error:\n' +
((e.error && e.message) || JSON.stringify(e)));
}
});
}
I think the documentation on relations is somewhat thin: docs.appcelerator.com/arrowdb/latest/#!/guide/relationalfields I can't seem to figure out the "fieldname_id" part? in [ACS_] For what I understand, it should be: [ACS_File]ID_id if it is the id field of the File object I want refference!?
The confusing thing is that for example images is refferenced like this: [ACS_Photo]picture_id !? How should I know that the "fieldname" is called "picture" for the Photo object. Where is that documented? Sorry, but it is frustrating. And I've tried all thinkable combinations for the File object without luck..
Hello, I tried to test the code you provided. It seems you have a code error. There is no field's called custom_fields in Cloud.Messages. Can you please explain a little more on what you are trying to do. Also provide a clear code that youa re using. Regards, Sharif.