Olli
Olli

Reputation: 532

how to add arrays to Event in #appcelerator

I'm trying to create a guestlist by having users send their user_id to an array in a custom_field in the Event object in appcelerator.

Cloud.Events.update({
    event_id: event.id
    custom_fields: {'guestlistarray':guestlist }
}, function (e) { 
    if (e.success) {
        var event = e.events[0];
        alert('You added it, maybe');
    } else {
        alert('Error:\n' +
            ((e.error && e.message) || JSON.stringify(e)));
    }
});

I have tried this by updating the event (by the person who wants to apply) by only sending information to the custom field, I have tried pushing in values but all it does is completely replace the guestlistarray. I need it to append continuously so that users keep adding to the guestlistarray, any help would be very appreciated.

Upvotes: 0

Views: 137

Answers (1)

Ray
Ray

Reputation: 486

I think you would need to read the array value from the current record, then push the additional value to the returned array, then update... That should work.

The other item to investigate is using 'checkins'. This let's a user 'checkin' or 'checkout' of an event, thus automatically creating a 'guest list'. Then you can query checkins for event x, would give you a list of everyone.

Ray

Upvotes: 1

Related Questions