Skip to content

Smart View Config

Smart View refers to the formatting and display of file content referenced via a URI in a Platform 6 document or the Platform 6 document itself.

Configuration requires editing the view XML definition. In particular the <Viewables> and <SmartTags> elements of this XML file.

For example:

            <FR>Accès doc.</FR>
        <Type key="View_Document_${BusinessDocumentName}_${CurrentDocumentFormat}">SURI</Type>

            <EN>Doc. Form</EN>
        <Type key="Document_Form_${BusinessDocumentName}_${CurrentDocumentFormat}">SDOC</Type>

Here the <Type> is set to SURI (Smart URI) or SDOC (Smart Document) and a key attribute is used to specify the name of a script to run to format the content of the URI or document.

If the key attribute contains ${tokens} then the name of the script will be constructed via SmartTag Resolution.

SmartTag Resolution

SmartTags are general name/value pairs associated with a <Document>. When used with the key attribute of an SURI type <Viewable> the SmartTag values must be XPaths to current document text elements.

For example:

       <EN>Invoices and Exceptions</EN>

Therefore resolution of SmartTags in this case will involve additional XPath lookup of text nodes and their text values replacing the SmartTag tokens. The above key attribute value may therefore be resolved to: View_Document_Invoice_PIDX.

Smart View Display

Once one or more SURI/SDOC <Viewables> have been configured in this way, the standard documents View/Edit links will cause a script to be called to produce the content to display.

Both raw and html formatted data will be displayed on a panel tab allowing the user to switch between Display and Source views.


The script will be executed with the URI or document content as the text input pipeline variable and it must return formatted html in a pipeline variable called html.

If the ‘raw’ (Source data) is modified, the formatting script is called once again when any changes are saved.

Smart View Edit Forms

An SURI/SDOC script than returns form pipeline variables will cause an additional Edit view to be displayed in addition to the Display And Source views.

Once a form is edited and submitted (saved) the configured form script will be called with the JSON encoded form data as it’s input pipeline variable.

This allows elements of the underlying source document to be updated in a controlled manner.

Form pipeline variables Description
form-js A very specialised javascript class using Extjs 4.2 to render a form.
form-id The name given to the Ext form object in the form-js.
form-data JSON encoded data object used to pre-populate the form fields before display.
form-script The name of a script to call once the Edit form is saved.



Extjs 4.2 help on forms:!/api/Ext.form.Panel

def formjs = '''
var amalto = amalto || {};
amalto.b2box = amalto.b2box || {};
amalto.b2box.formjs = amalto.b2box.formjs || {};
( function() {
    amalto.b2box.formjs.Test123 = function() {
        var anchor = '80%';
        this.form = new Ext.FormPanel({
            trackResetOnLoad : true,
            anchor : '100%',
            bodyStyle : 'padding:5px',
            items : [
                    xtype : 'textfield',
                    fieldLabel : 'Last Name',
                    labelWidth : 180,
                    name : 'lastname',
                    anchor : anchor
                    xtype : 'textfield',
                    fieldLabel : 'First Name',
                    labelWidth : 180,
                    name : 'firstname',
                    anchor : anchor
                    xtype : 'textfield',
                    fieldLabel : 'Email',
                    labelWidth : 180,
                    name : 'email',
                    anchor : anchor
                    xtype : 'textfield',
                    fieldLabel : 'Company',
                    labelWidth : 180,
                    name : 'company',
                    anchor : anchor
    amalto.b2box.formjs.Test123.prototype.getForm = function () {
        return this.form;
} )();
p6.pipeline.put 'form-js', formjs
p6.pipeline.put 'form-id', "Test123" // Must correspond to the name of the js class

// JSON form data.  FieldName:Value
def formdata = '''{
    "lastname": "Temple",
    "firstname": "Simon",
    "email": "",
    "company": "Amalto Technologies"
p6.pipeline.put 'form-data', formdata

// The script to process the form save.
p6.pipeline.put 'form-script', "Update_Document_Invoice_PIDX"


import groovy.json.JsonSlurper

def slurper = new JsonSlurper()
def result = slurper.parseText( pipeline.get('text') )

println "Last Name : " + result.lastname
println "First Name: " + result.firstname
println "Email     : " +
println "Company   : " +