Hi Robert
I want to send a record ID to be used to associate with the document that has been uploaded. As this is an asynchronous process, when the callback method is invoked there is no guaranteed way of identifying which record was selected at the point the upload request was made. If I am reading the docs correctly then in the smart client the callback is not necessary and the file objects are returned to the method that called the dialog and so it is easy to deal with the necessary parameters. For example in the smart client:
- Code: Select all
/**
* Upload a document
*
* @param {UUID} recordId
*
* @author Steve Hawes
* @since 2016-04-25
*
* @public
*
* @properties={typeid:24,uuid:"E9A877FF-D63B-41B9-8BC9-E6EA40F36E9F"}
*/
function uploadDocument(recordId) {
var filesObj = plugins.file.showFileOpenDialog(1, null, false, scopes.svyDocumentManagement$impl.getDocumentFilter(), null, i18n.getI18NMessage(scopes.tmleMessages.title.confirm));
filesObj.forEach(function(f) {
// Do something here with both the file object and the record ID
});
}
However in the web client (and presumably the NG client) the callback is necessary as the FilesObj will contain nothing. When the callback is then invoked it has no knowledge of the recordId and trying to use global variables or checking the foundset in forms does not guarantee that you will get the correct information as it may have changed in the meantime.
Hopefully I've explained it well enough so that my use case is clearer now?
It may also be the case that I am misunderstanding the process - in which case I would be happy to be enlightened
Thanks
Steve