Smart task container interface
The user task container is an extended init form container. It means that it should implement the same interface as the init form container (except for the context field) and plus:
- Object data
- json
get(string contextName, string filter) - feed
getFeed(string contextName, string filter)
Contains routines for getting data from the data context. Encapsulates online/offline data management from the form.
Returns a single page of OData response (in online mode) or a complete set of offline data for the specified context. See the description of the JSON type below. The parameter “Filter” is an additional OData like string that should be added to the original OData request (this functionality can be changed in future).
Returns feed object with a first page of OData response (in online mode) or a complete set of offline data for the specified context. See the interface of the feed type below. The parameter “Filter” is an additional OData like string that should be added to original OData request (this functionality can be changed in future).
Executes the action on the user task and supplies data. It should return false in case of error (after showing the error). False as response after error made possible to do some other actions in this task.
- JSON capabilities
- print – having the capability in the list means that printing is supported.
- online - having the capability in the list means that container is in online mode.
- execute – having the capability in the list means that an action can be executed.
Provides a JSON list of an array of string values in JSON format. For now, there are the following capabilities:
The list should be maintained along emerging new capabilities.
- json
getContextData()
Returns data for Context section of smarttask Metadata XML. See the description of the JSON type below.
- bool
executeUserTask()
Executes a user task and should change User Task status. It should return false in case of error (after showing error). False as response after error made possible to do some other actions in this Task.
- bool
executeNonFinalAction(string name, JSON data)
Executes an action which does not change the state of the user task and supplies data. In case of an error, it will return false. After this action it is possible to do other actions in this task.
- feed
getOdataFeed(string query) - json
getOdataEntry(string query) executeAllActions(string noFinalName,json noFinalData, string finalName, json finalData)getPreselectedValues()
Returns a feed object with a first page of an OData response for the OData request provided as a parameter (in online mode). In offline mode, it should return an empty feed.
Returns a JSON object as a result of the OData response for the OData request provided as a parameter (in online mode). In offline mode, it should return the result null.
Executes non-final actions at first and then executes final actions.
Returns a JSON string as a Dictionary of Keys to Arrays of IDs for the pre-selected values functionality. It is allowed to preselect values in selector controls. For example, {"PreSelectParties":[{"ID":"381"},{"ID":"201"}],"PreSelectDocuments":[{"ID":"435"},{"ID":"436"},{"ID":"494"}]}".
Properties
SupportAsyncsupportExecuteAllActionssupportPreselectedValuesSupportExternalDocumentUpload
if True, the container is working in Async mode and all functions are called with callback as last the parameter.
if True, the container has the executeAllActions function.
if True, the container supports pre-select Values functionality.
If True, the container supports uploading files from the desktop file system.
Interface of feed type
- bool
hasMorePages
defines if is there any more data in the feed that can be returned by calling next() function.
Passing JSON data
JSON data is passed to / from container in a string form.
Smart task container initialization sequence
- Preprocess HTML:
- Replace
<BASE/>tag if local assets cache is used. - Parse smart task metadata XML contained in the body of smart task.
- Initialize container instance with context and data contexts taken from parsed metadata.
- Create web-browser / iframe and load HTML content there.
-
When the content is loaded, attach the container instance to web-browser / iframe if necessary, and invoke window.init(container) in the context of web-browser / iframe. For Outlook (If WebBrowser control is used), window.external should be used as a container argument.
Smart task metadata XML schema
See descriptions of each response template under Response Templates.
<context register="wzp_user_task" key="21">
***
</context>
<responsetemplates>
<responsetemplate name="Actions>
***
</responsetemplate>
<responsetemplate name="Forward>
***
</responsetemplate>
<responsetemplate name="Update>
***
</responsetemplate>
</responsetemplates>
<data>
<datacontext name="ForwardActors" query="***">
***
</datacontext>
<datacontext name="ActionLog" query="***">
</datacontext>
<datacontext name="AnswerDocuments" query="***'">
</datacontext>
</data>
<smarttask>
<context register=”wzp_usertask” key=”123”/>
<data>
<datacontext name=”Cases” query=”Files”>
<!-- offline data goes here -->
</datacontext>
<datacontext name=”Contacts” query=”Contacts?$select=ID,Summary”>
<!-- offline data goes here -->
</datacontext>
</data>
</smarttask>
The way smart task meta data and base address is present in HTML (required for preprocessor, take into an account that HTML is not XML, so you shouldn’t parse the whole smart task form using XML parser):
<!doctype html>
<html>
<head>
<base href=”...”/>
...
</head>
<body>
...
<script language=”text/xmldata” id=”metadata”>
<smarttask>
...
</smarttask>
</script>
</body>
</html>
Response Templates
Actions
The response template "Actions" contains the following fields:
- Action: The action the response is issuing.
- Comment: The comment that follows the action.
- Properties: The user task properties.
- Answers: An optional
Record[]containing the response documents. - Identity : The user task identity.
Forward
The response template "Forward" contains the following fields:
- Action: The action the response is issuing.
- Comment: The comment that follows the action.
- Properties: The user task properties.
- Answers: An optional
Record[]containing the response documents. - Identity: The user task identity.
- Actor: The actor that the user task is forwarded to.
Update
The response template "Update" contains the following fields:
- Action: The action the response is issuing.
- Comment: The comment that follows the action.
- Properties: The user task properties with updated documents.
- Answers: An optional
Record[]containing the response documents. - Identity: The user task identity.
- Attachments: The properties containing updated attachments.
- Actors: The updated actor list with new/obsolete/reordered actors.