Titanium JIRA Archive
Appcelerator Community (AC)

[AC-3598] Relation fields in ArrowDB Appcelerator and File objects

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionNeeds more info
Resolution Date2016-05-17T14:02:15.000+0000
Affected Version/sAppcelerator Studio 4.5.0
Fix Version/sn/a
ComponentsArrowDB
Labelsn/a
ReporterJan Frode Maurice
AssigneeShak Hossain
Created2016-05-05T17:29:18.000+0000
Updated2016-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..

Comments

  1. Sharif AbuDarda 2016-05-10

    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.

JSON Source