Skip to content

createDocumentFromTemplate

Updated pdexter 2022-10-22

(Applies to both client-side + server-side function)

Creates a new document according to a given template.

Syntax

ft3.createDocumentFromTemplate(doc-info, templateID, userID, function(err,doc) {

‚Äč ...

});

Part Description
doc-info JSON object of the properties to write to the new document.
nb - do not include systemHeader information. This will be catered for by use of the templateID.
templateID the ID of the template to use to create the document.
userID the User ID to use for creation.
err error returned by process -- null if successful
doc the created document

Example

    var newDocInfo = {
            "name": "Jennifer",
            "age" : 23,
            "description" : "Here lies the messenger." 
            };
    var templateID = '5511e701d1e0d8d0a7cc5414';

    var ft3 = ntf.scope;

    ft3.createDocumentFromTemplate(newDocInfo, templateID, ntf.user.documentId,
    function(err, doc) {
        if (err) {
            ntf.logger.error('Error creating document: ' + err);
        }
        else {
            ntf.logger.info('Document created: ' + doc.documentId);
        }
    });

See also

openNewDocument