Skip to content

openNewDocument

Updated pdexter 2022-10-22

Opens a new document of a given template, in the current or a new window.

(client-side function)

Syntax

ft3.openNewDocument( template-id, initial-values, new-window, function(err) {

        ...

});

where

Part Description
template-id id of the template to open
initial-values JSON structure of initial field values
new-window indicates whether to use a new window, or the current one
values: true for new window/tab; false for current window
callback function to call when operation has completed

Example

       var ft3 = ntf.scope;
       var TPL_ID = 'b62410d1e601a95aacdb9c6f';
       var initialValues = {
            'genus'   : 'Cicadidae',
            'species' : 'Exuviae',
            'commonName' : 'Cicada'
       };

       ft3.openNewDocument(TPL_ID, initialValues, 'yes', function(err){
            if (err) {
                ntf.logger.info('Error opening new document: ' + err.message);
            }
            else {
                ntf.logger.info("New document opened.");            
            }
       });

Note

For a server side version, see createDocumentFromTemplate.