I made a drive picker for attaching files in a description of a ticket.
I want to be able to attach more than one file so I made in the features of the Drive Picker "MULTISELECT_ENABLED",Now I can select more than one item from my drive but it return one item only.
I want to know how to return the array of the selected items?

Also when I searched for that, I found that uploading a new item to your drive using drive picker would cause a problem if another user wants to see this item, he will not be able due to sharing options. I want to know how to be able to attach more than an item in the description of a ticket whether by a drive picker or not.
Update1:
I created a new table for the attachments instead of putting its fields in Tickets table and made a relation One to Many. I modified the code in the proposed answer on Document select:
// onDocumentSelect Drive Picker's event handler
var create = widget.root.datasource.relations.Tickets_Attachments.modes.create;
var tickets = app.datasources.Tickets;
var attachments = app.datasources.Tickets_Attachments;
result.docs.forEach(function(doc) {
create.item.Attachment_name = doc.url;
attachments.saveChanges();
create.createItem();
});
tickets.saveChanges();
But this error appeared:
"Cannot create new record in relation datasource unless parent record exists."
So changed the code to the above one and saved the changes after creating an attachment item but nothing changed.
