Skip to content

Full Template Definition

The examples / images in the previous topic showed abridged versions of the template / document Let's look at a few other items that we recommend be included on a template:

{
    "documentId": "e1dd9940-ba26-11e8-9aef-99f092bfb6a5",
    "systemHeader": {
        "templateId": "54d96f610bc006eb84369a8b",
        "systemType": "template",
        "createdWith": "74746c80-8378-11e6-99b1-71ee944cf59f",
        "keyIds": [],
        "versionId": "f7ba5980-ba38-11e8-8690-bdece58e9366",
        "excludeGeneralSearch": false,
        "currentVersion": true,
        "createdDate": "2018-09-17T05:17:27.192Z",
        "createdBy": "5435d78388968497030106d0",
        "summaryName": "TEST TEMPLATE",
        "summaryDescription": "TEST TEMPLATE Description",
        "serverUpdatedDate": "2018-09-17T05:17:27.219Z",
        "serverCreatedDate": "2018-09-17T05:17:27.219Z",
        "previousVersionId": "eeec0420-ba38-11e8-8690-bdece58e9366"
    },
    "components": [
        {
            "componentName": "sc-static-value",
            "name": "appTags",
            "value": [
                "myApplication",
                "myCategory"
            ],
            "visible": false
        },
        {
            "componentName": "sc-date-time",
            "label": "Date Submitted",
            "name": "dateSubmitted"
        },
        {
            "componentName": "sc-text-box",
            "label": "Reproducibility",
            "name": "reproducibility"
        },
        {
            "componentName": "sc-drop-down",
            "label": "Severity",
            "name": "issueSeverity",
            "dropDownList": [
                "Trivial",
                "Minor",
                "Major",
                "Critical"
            ]
        }
    ],
    "summaryDescriptionRule": "TEST DOCUMENT DESCRIPTION",
    "summaryNameRule": "Example Rule: {{{reproducibility}}}",
    "formColor": "#fefefe",
    "appTags": [
        "myApplication",
        "myCategory"
    ],
    "name": "This is my template name"
}

Parameters to note: - systemHeader.summaryName - displays the value in the application framework and is used to display the name of the document in search results and grids - systemHeader.summaryDescription - optional additional information - displayed in full global search results - summaryDescriptionRule - this is used to write to the systemHeader.summaryDescription of the document produced by the template when saved. - summaryNameRule - as with the summaryDescription rule - this is used to write to the systemHeader.summaryName field of the document produced by the template. Note the use of 'handlebars' {{{reproducibility}}}. Handlebars are used throughout the application to access values entered into the document. This example will take the text that is entered into the component with the 'name':'reproducibility' parameter and use it as input to the systemHeader.summaryName on the document. So if for example the user enters 'Yes' into the field, the resulting systemHeader.summaryName of the document will be 'Example Rule: Yes' - formColor - this can be either a html colour name or a hex colour. This sets the background colour of the template and document.

Special Note on 'appTags': - appTags:[ .... ] - appTags is a convention that Formbird application developers created early on. It is not mandatory, but it is recommended.
It is quite easy to 'lose' documents if you're not careful. The appTags array is one way to group all of the documents for an application. If everything is tagged, then it's a simple matter of searching for the tag name in a grid or in the database.
For example: I could construct a query that says 'get me all documents with 'myApplication' on them and display their summaryName fields in a grid.
If the array contains multiple entries it is then possible to categorise the documents quite easily. Example:
You may have one set of documents with a field of "appTags":["myApplication","category1"] and another with "appTags":["myApplication","category2"] You can then construct a search for all documents with 'myApplication' and it will return both category1 and category2 documents, You can also construct a search for all documents with 'myApplication' AND 'category1' which will return the category 1 subset of all the documents.

  • corresponding to the appTags array is the 'sc-static-value' component. The sc-static-value component writes the 'value' field to the document. It can be used to write any value to a document, but in this case it will write "appTags":["myApplication","myCategory"] to the document at the root level, ensuring that any search for 'myApplication' will return the document.

You may notice that in this example we would have 'templates' and 'documents' both with the same appTags - if I needed only the documents I could search for 'systemHeader.systemType':'document' AND 'appTags':["myApplication"] and return only documents.

This is the template displayed as per the definition above: Note the systemHeader.summaryName field "TEST TEMPLATE" displayed on the right of the 'New' button and the 'name' field of the template displayed on the left of the 'Print' button;

              alt text

Resulting Document

{
    "documentId": "112cdbc0-ba2c-11e8-b241-7568144d4841",
    "systemHeader": {
        "templateId": "e1dd9940-ba26-11e8-9aef-99f092bfb6a5",
        "systemType": "document",
        "createdWith": "e1dd9940-ba26-11e8-9aef-99f092bfb6a5",
        "keyIds": [],
        "versionId": "d7d84550-ba38-11e8-907d-4b32807e54a5",
        "excludeGeneralSearch": false,
        "currentVersion": true,
        "createdDate": "2018-09-17T05:16:33.701Z",
        "createdBy": "5435d78388968497030106d0",
        "summaryName": "Example Rule: Yes",
        "summaryDescription": "TEST DOCUMENT DESCRIPTION",
        "serverUpdatedDate": "2018-09-17T05:16:33.741Z",
        "serverCreatedDate": "2018-09-17T05:16:33.741Z",
        "previousVersionId": "19147aa0-ba2c-11e8-ad0c-7b1e920f059f"
    },
    "dateSubmitted": "2018-09-17T03:45:11.974Z",
    "reproducibility": "Yes",
    "issueSeverity": "Trivial",
    "appTags": [
        "myApplication",
        "myCategory"
    ]
}

Note - the appTags array at the root level of the document - the systemHeader.summaryName using the data entered by the user - the systemHeader.summaryDescription field on the document

              alt text

Note: - the template 'name' field to the left of the 'Print' button - the systemHeader.summaryName field to the right of the 'New' button