Receive a Request From Intelligent Advisor to Save Data

A policy model utilizing the metadata sent from a web service connector can output data from an interview if the mapping settings in the policy model are set to create a new table or update an existing table at the end of the interview. If this is the case, then whenever a Submit button is clicked during the interview (provided there are no input errors on that screen), a Save request will be sent from the interview service to the connector associated with that policy model.

The Save request will include:

  • the name of the table to which the Global entity in the policy model is mapped, in the root attribute. This is important to know for the web service because when the service provides more than one table with can-be-output="true" in the metadata, a policy model may be globally output mapped to any of those tables. The root attribute indicates which of the tables is actually mapped to the Global entity.
  • the region, language and timezone as set in the policy model, in the region, language and timezone attributes respectively. Note that the language attribute is generally more useful for a connector during Load requests, but may be used as seen fit for Save requests.
  • the name value pairs which were appended to the start session URL, as parameter elements in the request-context element. For example, for the URL https://[mysite]/web-determinations/startsession/Car%20Interview?myParam=myValue&myOtherParam=otherValue the parameters would be as follows:

    <parameter name="myParam" value="myValue"/>
    <parameter name="myOtherParam" value="otherValue"/>


    For more information on using URL parameters to set request context, see Use URL Parameters to Specify Context.
  • instances of any mapped entities, as table elements. (The name of one of them matches the root attribute of the save-request element to identify this as the table mapped as the Global output table.)
  • whether data from each input-field element within a row element should be inserted (action="create") or updated (action="update").
  • each of the attribute values belonging to the mapped entities which have been output-mapped to fields. These fields will be within input-field elements with a name attribute that identifies the field which the connector will receive data for, and a corresponding field type value element. Note that the interview will send the value of a number attribute through in Save requests within a number-val element with the value entered during the interview, but restrictions on whether this is an integer or decimal value are set in the policy model itself, not by the connector.
  • any data specified in the policy model as Load after submit. These will be empty output-field elements with the attribute name identifying the field to retrieve data for. Typically a value is retrieved, generated or calculated by the connector after or during the save request which did not exist prior to save request, such as a newly created ID. The connector already knows the data type to return because the field was described by the connector in the metadata.
  • the global row that may relate to zero or more named rows of a child table, in the link element . Each ref element within the link describes the target row by its id.
  • any attachments that were uploaded by the user, or forms which are generated and attached to a particular Submit button. These attachments will be within the attachments element of the Save request. Any attachments collected by an upload control will end up in the Save request under the row instance corresponding to the entity instance which the screen was collecting for. This is in contrast with generated forms which are not bound to an entity instance, so appear at the root level of the Save request and not under a particular row. The connector is responsible for processing attachments, but does not need to return anything in the response concerning how they were processed. If the attachment is a generated form, it will have:
    • a name attribute as specified in the policy model
    • a filename attribute with the value of the name appended with the file type, and
    • a description attribute containing "Form auto generated by Intelligent Advisor.".

    If the attachment was attached using an upload control, it will only have the filename attribute with the value of whatever it was uploaded as.

The following is an example of a Save request:

<save-request root="Car Request" region="en-US" language="en-US" timezone="Etc/GMT">
    <request-context>
        <parameter name="param1" value="value1"/>
        <parameter name="param2" value="value2"/>
    </request-context>
    <tables>
        <table name="Car Request">
            <row id="global" action="create">
                <input-field name="Selected Model">
                    <text-val>Zippy-9</text-val>
                </input-field>
                <input-field name="Contact Name">
                    <text-val>John Smith</text-val>
                </input-field>
                <output-field name="Request ID"/>
                <link name="Customer's Phone Numbers" target="Customer's Phone Number">
                    <ref id="the customer's phone number1"/>
                    <ref id="the customer's phone number2"/>
                </link>
            </row>
        </table>
        <table name="Customer's Phone Number">
            <row id="the customer's phone number1" action="create">
                <input-field name="phone_number">
                    <text-val>123456</text-val>
                </input-field>
                <input-field name="is_preferred">
                    <boolean-val>true</boolean-val>
                </input-field>
            </row>
            <row id="the customer's phone number2" action="create">
                <input-field name="phone_number">
                    <text-val>6 123 456</text-val>
                </input-field>
                <input-field name="is_preferred">
                    <boolean-val>false</boolean-val>
                </input-field>
            </row>
        </table>
    </tables>
    <attachments>
        <attachment name="Car Order" filename="Car Order.pdf" description="Form auto generated by Intelligent Advisor.">
            JVBERi0xLj... FT0YNCg==
        </attachment>
    </attachments>
</save-request>

This example shows:

  • the creation of a Car Request table corresponding to the Global entity in the policy model. For the Car Request table:
    • data from each input field (Selected Model and Contact Name) within this row should be inserted
    • the metadata for the fields Selected Model and Contact Name have text values and therefore must have described the field’s types as STRING
    • a value for an output field named Request_ID has been requested
    • there is a link reference to the ‘the customer’s phone number1’ and 'the customer's phone number2' rows of the Customer’s Phone Number table
  • the creation of a child Customer's Phone Number table corresponding to the entity 'the customer's phone number' in the policy model. For the Customer's Phone Number table:
    • the creation of a table row for each instance of the customer's phone number entity, recording text attribute values for the phone number and for the Boolean attribute named 'is_preferred'
    • the action on ‘the customer’s phone number1’ and 'the customer's phone number2' is create, and this is because the row is referred to via a link from another row whose action is also create
  • the attachment of one generated form, a PDF file named 'Car Order'.