- Code: Select all
var attachments = { };
var atta = [ ];
function dc_newCustomToolbar( event, triggerForm, toolbarForm, createRecordOnTop ) {
var attachment;
attachment = plugins.file.showFileSaveDialog( );
_super.dc_newCustomToolbar( event, triggerForm, toolbarForm, createRecordOnTop );
if ( attachment ) {
attachments[ id_nr ] = attachment;
atta.push( [ id_nr, attachment ] );
application.output( attachments[ id_nr ].getName( ) );
}
}
function importAttachment( event, documentId ) {
if ( attachments ) {
for ( var idNo in attachments ) {
if ( attachments.hasOwnProperty( idNo ) ) {
application.output( idNo + ' ' + attachments[ idNo ] )
}
}
}
}
If I call dc_newCustomToolbar again, then all before added content is available in the attachments object.
What I'm missing?