Remote Widget

The widget type remote consist of a prompt, an editable field and a button. The button triggers a remote API call. The response body of the request is shown in a dialog and a specific part of the response body can be set as value of the field.

The complete feature set of this widget type is currently only supported in the Change Quantities activity, which is displayed when editing delivery information for itemsPlanned. Features like the output widget option may not be supported in other places.

Attributes

See the Widget page for general information about attributes of a widget. The following concentrates on the specific use of attributes for the type remote.

Name Description Example
editable Defines whether or not the field is editable. If the output option is defined, this attibute controls whether or not the button can be pressed. false
prompt The label of the field. If the output option is defined, this attribute defines the label of the button. If the output option is not set, the button label is set from the verb "Retrieve" and the prompt. Total Amount

Options

Value Optional Description Example
dataType yes Set the data type of the field. Supported values are integer, float, dateTime and string. The default is integer. string
host yes Name of the API host. The default is the host defined in the application settings. www.example.com
resource no Path to the API resource. /omdservices-basic/rs/v1/team/reporting
param:parameterName yes Name and value of a query parameter for the remote API. Multiple parameters can be defined in multiple options. See below for details about the description field of the option. param:configId
viewTemplate no An XSL template used to transform the API response body for display after pressing the retrieve button. see below
mimeType yes The MIME type used for displaying the transformation result of the viewTemplate. The default type after a successful transformation is text/html. text/plain
valueTemplate no An XSL template used to transform the API response body for setting the value of the provided field or output widget. see below
output yes The name of an alternative widget to set the resulting value from valueTemplate to. In case the remote widget is a component in a subUI, the subUI is searched first, then the MobileUI is searched. Setting this option also results in hiding the field and prompt provided by the remote widget and has an effect on what widget component may be enabled or disabled (see above). Q1T
input yes The name of a widget holding a value that must be added to the result of the valueTemplate. The name is expected to match an attribute from the localExtra's XML root element, so it must be part of the MobileUI. Q1
resultTemplate:format yes An XSL template used to transform the API response body to the extra information of a remoteResult task attachment. If the option description is empty, the response body is simply copied to the extra. see below

Query Parameters

Query parameters for the remote API can be defined in multiple param: options. The name of the parameter must be appended to the param: prefix of the option value, e.g. param:processFlow. The value for the description of the option can be a reserved keyword, an XPath expression, or a static text.

The following keywords are supported:

Name Value
configId Configuration ID of the current task.
taskId External ID of the current task.
processFlow Value of the field processFlow of the current task attachment.
reference Value of the field reference of the current task attachment.
format Value of the field format of the current task attachment.
content Value of the field content of the current task attachment.

An XPath will be evaluated from the localExtra of the current task attachment, which represents the widgets and their values of the current MobileUI as XML. If no match can be found here, the expression is evaluated from an XML-representation of the current task and its extra field as embedded element.

View Template

The viewTemplate option sets the XSL template to transform the response body of the API before display in a web view. For example:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

    <xsl:output method="html" encoding="utf-8"/>

    <xsl:template match="/">
        <html>
            <style type="text/css">
                .body { color:#FFF;background-color:#000; }

                .table1 { border-collapse:collapse;padding-bottom:10px;width:100%; }
                .table1 td { padding:5px; }

                .table2 { color:#000;background-color:#BBB;border-collapse:collapse;padding-bottom:10px;width:100%; }
                .table2 th { padding:5px;border-left:solid #000;font-weight: normal; }
                .table2 td { padding:5px;border-left:solid #000;background-color:#CCC; }
            </style>
            <body class="body">
                <table class="table1">
                    <tr>
                        <td>Gesamtmenge Q1T:</td>
                        <td style="text-align:right"><xsl:value-of select="/TeamReporting/@q1T"/></td>
                    </tr>
                </table>
                <p/>
                <table class="table2">
                    <tr>
                        <th>offene Tasks</th>
                        <th>Datum Uhrzeit</th>
                        <th>Status</th>
                        <th>Ressource</th>
                    </tr>
                    <xsl:apply-templates select="@*|node()"/>
                </table>
            </body>
        </html>
    </xsl:template>

    <xsl:template match="Task">
        <tr>
            <td>
                <xsl:value-of select="@externalId"/>
            </td>
            <td>
                <xsl:value-of select="@scheduled"/>
            </td>
            <td>
                <xsl:value-of select="@status"/>
            </td>
            <td>
                <xsl:value-of select="./ScheduledFor/@fullName"/>
            </td>
        </tr>
    </xsl:template>

</xsl:stylesheet>

Value Template

The valueTemplate defines the transformation of the API response body to the value displayed in the provided field or the output widget.

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

    <xsl:output method="text" encoding="utf-8" indent="no"/>

    <xsl:template match="/">
        <xsl:value-of select="/TeamReporting/@q1T" />
    </xsl:template>

</xsl:stylesheet>

Result Template

The resultTemplate: options define XSL transformations of the API response body to the content of a remoteResult task attachment. The prefix resultTemplate: must be appended by a unique name. This name is used as value of the format field of the remoteResult attachment.

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">          
    <xsl:output method="xml" encoding="utf-8"/>          
    <xsl:template match="/">         
        <xsl:apply-templates select="@*|node()"/>     
    </xsl:template>          
    <xsl:template match="/TeamReporting">         
        <xsl:copy>             
            <xsl:apply-templates select="*"/>         
        </xsl:copy>     
    </xsl:template>          
    <xsl:template match="Task">         
        <xsl:copy>             
            <xsl:copy-of select="@id"/>             
            <xsl:copy-of select="@externalId"/>             
            <xsl:copy-of select="@status"/>         
        </xsl:copy>     
    </xsl:template>      
</xsl:stylesheet>

results matching ""

    No results matching ""