Árvore de páginas

Versões comparadas

Chave

  • Esta linha foi adicionada.
  • Esta linha foi removida.
  • A formatação mudou.
HTML

<div id="main-content" class="wiki-content group">
	<h3
		id="id-7.InteraçãocomoEnginedeWorkflowAtravésdeFormuláriosMetadados-7.1.Objetivo">
		<strong>7.1. Objective</strong>
	</h3>
	<p align="LEFT">Enable a Metadata form to interact with the
		workflow engine at Fluig, performing operations such as:</p>
	<ul>
		<ul>
			<li><p align="LEFT" class="western">
					<span>Starting a new process (start request)</span>
				</p></li>
			<li><p align="LEFT" class="western">
					<span>Cancel a request</span>
				</p></li>
			<li><p align="LEFT" class="western">
					<span>Change the deadline date of a task</span>
				</p></li>
			<li><p align="LEFT" class="western">
					<span>Change the task comments</span>
				</p></li>
			<li><p align="LEFT" class="western">
					<span>Return the value of a workflow form field</span>
				</p></li>
			<li><p align="LEFT" class="western">
					<span>Move request to next activity</span>
				</p></li>
			<li><p align="LEFT" class="western">
					<span>Select user(s) and advance automatic activity</span>
				</p></li>
			<li><p align="LEFT" class="western">
					<span>Assume a task</span>
				</p></li>
			<li><p align="LEFT" class="western">
					<span>Obtain the attachments of a request</span>
				</p></li>
			<li><p align="LEFT" class="western">
					<span>Return the activity number where the request is</span>
				</p></li>
			<li><p align="LEFT" class="western">
					<span>Return the number of the next activity in a request</span>
				</p></li>
			<li><p align="LEFT" class="western">
					<span>Return activity details available for selection</span>
				</p></li>
			<li><p align="LEFT" class="western">
					<span>Return users who can perform a current task in a
						request</span>
				</p></li>
			<li><p align="LEFT" class="western">
					<span>Return the processes the user can initiate in a
						request</span>
				</p></li>
			<li><p align="LEFT" class="western">
					<span>Returns the users available in opening a request</span>
				</p></li>
			<li><p align="LEFT" class="western">
					<span>Searches processes available for initialization </span>
				</p></li>
		</ul>
	</ul>
	<p align="LEFT">
		Interaction with the wokflow engine will be made via ABLScript codes
		using the command <strong>ECM-REQUEST-SERVICE()</strong>. This command
		will perform calls to the <strong>WorkflowEngineService</strong>, as
		shown in the following diagram:
	</p>
	<p align="LEFT">
		<img class="confluence-embedded-image image-center"
			src="http://tdn.totvs.com/download/attachments/81789205/Screenshot1.png?version=1&modificationDate=1381259170000&api=v2"
			data-image-src="http://tdn.totvs.com/download/attachments/81789205/Screenshot1.png?version=1&modificationDate=1381259170000&api=v2">
	</p>
	<p align="LEFT" style="text-align: center;">
		<strong>Figure 6.1.a</strong>
	</p>
	<h3
		id="id-7.InteraçãocomoEnginedeWorkflowAtravésdeFormuláriosMetadados-7.2.GuiadeProgramação">
		<strong>7.2. Programming Guide</strong>
	</h3>
	<p>
		<strong>Syntax for command ECM-REQUEST-SERVICE:</strong>
	</p>
	<div class="code panel pdl" style="border-width: 1px;">
		<div class="codeContent panelContent pdl">
			<pre class="theme: Confluence; brush: xml; gutter: false"
				style="font-size: 12px;">variable = ECM-REQUEST-SERVICE(serviceID, operationId, [param1, param2, param3, ...]).</pre>
		</div>
	</div>
	<p>&#160;</p>
	<p>
		<strong>Where:</strong>
	</p>
	<ul>
		<li><p align="LEFT" class="western">
				<strong>variable</strong>:<span> variable of the CHARACTER
					type which will receive the command execution response. The answer
					may come as a single character, which can be converted to another
					type through functions DECIMAL(), INTEGER() or DATE(). Or it may be
					a JSON character that will be converted to a TEMP-TABLE through the
					JSON function - DECODE().</span>
			</p></li>
	</ul>
	<ul>
		<li><p align="LEFT" class="western">
				<strong>serviceID</strong>:<span> character with the ID of
					the service to be performed in Fluig. To meet the requirements
					defined in this document, the <strong>serviceId</strong>="<strong>WORKFLOW</strong>"
					should be used. In the future, methods may be implemented for
					accessing other services at Fluig, as for example DocumentService
					or FolderService.
				</span>
			</p></li>
	</ul>
	<ul>
		<li><p align="LEFT" class="western">
				<strong>operationID</strong>:<span> it identifies the
					operation (method) to be performed in WorkflowEngineService.
					Example: “START-PROCESS”.</span>
			</p></li>
	</ul>
	<ul>
		<li><p align="LEFT" class="western">
				<strong>param1, param2, ...</strong>:<span> list of
					parameters to be sent to the service.</span>
			</p></li>
	</ul>
	<h3
		id="id-7.InteraçãocomoEnginedeWorkflowAtravésdeFormuláriosMetadados-Operações">
		<strong>Operations</strong>
	</h3>
	<p>
		<strong>Operation ID: <span style="color: rgb(255, 0, 0);">START-PROCESS</span></strong>
	</p>
	<p>
		<strong>Description:</strong> Start a process.
	</p>
	<p>
		<strong>Return:</strong>TempTable
	</p>
	<p>
		<strong>Parameters:</strong>
	</p>
	<div class="table-wrap">
		<table class="confluenceTable">
			<tbody>
				<tr>
					<th class="confluenceTh">Name</th>
					<th class="confluenceTh">Type</th>
					<th class="confluenceTh">Description</th>
					<th class="confluenceTh">Details</th>
				</tr>
				<tr>
					<td class="confluenceTd">processId</td>
					<td class="confluenceTd">character</td>
					<td class="confluenceTd">Process code</td>
					<td class="confluenceTd">&#160;</td>
				</tr>
				<tr>
					<td colspan="1" class="confluenceTd">colleagueIds</td>
					<td colspan="1" class="confluenceTd">character</td>
					<td colspan="1" class="confluenceTd">Users who will receive
						the task</td>
					<td colspan="1" class="confluenceTd">use character in format:
						"colab1,colab2,colab3"</td>
				</tr>
				<tr>
					<td class="confluenceTd">activityNumber</td>
					<td class="confluenceTd">int</td>
					<td class="confluenceTd">Activity number</td>
					<td class="confluenceTd">&#160;</td>
				</tr>
				<tr>
					<td colspan="1" class="confluenceTd">comments</td>
					<td colspan="1" class="confluenceTd">character</td>
					<td colspan="1" class="confluenceTd">Comments</td>
					<td colspan="1" class="confluenceTd">&#160;</td>
				</tr>
				<tr>
					<td colspan="1" class="confluenceTd">completeTask</td>
					<td colspan="1" class="confluenceTd">logical</td>
					<td colspan="1" class="confluenceTd">Indicates if the task
						must be completed (true) or only saved (false)</td>
					<td colspan="1" class="confluenceTd">&#160;</td>
				</tr>
				<tr>
					<td colspan="1" class="confluenceTd">ttAttachments</td>
					<td colspan="1" class="confluenceTd">TempTable</td>
					<td colspan="1" class="confluenceTd">Request attachments</td>
					<td colspan="1" class="confluenceTd"><p>DEFINE TEMP-TABLE
							ttAttach</p>
						<p>&#160;&#160;&#160; FIELD documentId AS INTEGER</p>
						<p>&#160;&#160;&#160; FIELD documentVersion AS INTEGER</p>
						<p>&#160;&#160;&#160; FIELD description AS CHARACTER</p>
						<p>&#160; &#160; FIELD filename AS CHARACTER</p>
						<p>&#160;&#160;&#160; FIELD filepath AS CHARACTER</p>
						<p>&#160;&#160;&#160; FIELD principal AS LOGICAL.</p></td>
				</tr>
				<tr>
					<td colspan="1" class="confluenceTd">ttCardData</td>
					<td colspan="1" class="confluenceTd">TempTable</td>
					<td colspan="1" class="confluenceTd">Form data</td>
					<td colspan="1" class="confluenceTd"><p>DEFINE TEMP-TABLE
							ttCard</p>
						<p>&#160; &#160; FIELD fieldName AS CHARACTER</p>
						<p>&#160; &#160; FIELD fieldValue AS CHARACTER.</p></td>
				</tr>
				<tr>
					<td colspan="1" class="confluenceTd">ttAppointment</td>
					<td colspan="1" class="confluenceTd">TempTable</td>
					<td colspan="1" class="confluenceTd">Task annotations</td>
					<td colspan="1" class="confluenceTd"><p>DEFINE TEMP-TABLE
							ttAppointment</p>
						<p>&#160;&#160;&#160; FIELD appointmentDate AS CHARACTER</p>
						<p>&#160;&#160;&#160; FIELD appointmentSeconds AS INTEGER</p>
						<p>&#160; &#160; FIELD appointmentSequence AS INTEGER.</p></td>
				</tr>
				<tr>
					<td colspan="1" class="confluenceTd">managerMode</td>
					<td colspan="1" class="confluenceTd">logical</td>
					<td colspan="1" class="confluenceTd">Indicates whether the
						user is initiating the request as a process manager.</td>
					<td colspan="1" class="confluenceTd">&#160;</td>
				</tr>
			</tbody>
		</table>
	</div>
	<p>&#160;</p>
	<p>
		<strong>Operation ID:</strong> <span style="color: rgb(255, 0, 0);"><strong>CANCEL-PROCESS</strong></span>
	</p>
	<p>
		<strong>Description:</strong> Cancels a process.
	</p>
	<p>
		<strong>Return: character<br /></strong>
	</p>
	<p>
		<strong>Parameters:</strong>
	</p>
	<div class="table-wrap">
		<table class="confluenceTable">
			<tbody>
				<tr>
					<th class="confluenceTh">Name</th>
					<th class="confluenceTh">Type</th>
					<th class="confluenceTh">Description</th>
				</tr>
				<tr>
					<td class="confluenceTd">processInstanceId</td>
					<td class="confluenceTd">integer</td>
					<td class="confluenceTd">Process code</td>
				</tr>
				<tr>
					<td class="confluenceTd">cancelText</td>
					<td class="confluenceTd"><p>character</p></td>
					<td class="confluenceTd">Cancellation comments</td>
				</tr>
			</tbody>
		</table>
	</div>
	<p>
		<strong><br /></strong>
	</p>
	<p>
		<strong>Operation ID: <span style="color: rgb(255, 0, 0);">SET-DUE-DATE</span><br /></strong>
	</p>
	<p>
		<strong>Description: </strong>Changes the deadline date for the task.<strong><br /></strong>
	</p>
	<p>
		<strong>Return:</strong> character
	</p>
	<p>
		<strong>Parameters:</strong>
	</p>
	<div class="table-wrap">
		<table class="confluenceTable">
			<tbody>
				<tr>
					<th class="confluenceTh">Name</th>
					<th class="confluenceTh">Type</th>
					<th class="confluenceTh">Description</th>
				</tr>
				<tr>
					<td class="confluenceTd">processInstanceId</td>
					<td class="confluenceTd">integer</td>
					<td class="confluenceTd">Process code</td>
				</tr>
				<tr>
					<td class="confluenceTd">threadSequence&#160;</td>
					<td class="confluenceTd">integer</td>
					<td class="confluenceTd"><p>Indicates if there is any
							parallel activity in the process. If there are none, the value is
							0 (zero),</p>
						<p>if there are any, this value can range from 1 to infinity
							depending on the amount of parallel</p>
						<p>activities existing in the process.&#160;</p></td>
				</tr>
				<tr>
					<td colspan="1" class="confluenceTd">newDueDate</td>
					<td colspan="1" class="confluenceTd">character&#160;</td>
					<td colspan="1" class="confluenceTd">New deadline date for the
						task.&#160;</td>
				</tr>
				<tr>
					<td colspan="1" class="confluenceTd">timeInSeconds</td>
					<td colspan="1" class="confluenceTd">integer</td>
					<td colspan="1" class="confluenceTd">Task time in seconds.</td>
				</tr>
			</tbody>
		</table>
	</div>
	<p>&#160;</p>
	<p>
		<strong>Operation ID: <span style="color: rgb(255, 0, 0);">SET-TASK-COMMENTS</span><br /></strong>
	</p>
	<p>
		<strong>Description:</strong> Changes the results of the task.
	</p>
	<p>
		<strong>Return: </strong>character<strong><br /></strong>
	</p>
	<p>
		<strong>Parameters:</strong>
	</p>
	<div class="table-wrap">
		<table class="confluenceTable">
			<tbody>
				<tr>
					<th class="confluenceTh">Name</th>
					<th class="confluenceTh">Type</th>
					<th class="confluenceTh">Description</th>
				</tr>
				<tr>
					<td class="confluenceTd">processInstanceId&#160;</td>
					<td class="confluenceTd">integer</td>
					<td class="confluenceTd">Process code&#160;</td>
				</tr>
				<tr>
					<td class="confluenceTd">threadSequence&#160;</td>
					<td class="confluenceTd">integer</td>
					<td class="confluenceTd"><p>Indicates if there is any
							parallel activity in the process. If there are none, the value is
							0 (zero),</p>
						<p>if there are any, this value can range from 1 to infinity
							depending on the amount of</p>
						<p>parallel activities existing in the process.&#160;</p></td>
				</tr>
				<tr>
					<td colspan="1" class="confluenceTd">comments</td>
					<td colspan="1" class="confluenceTd">character</td>
					<td colspan="1" class="confluenceTd">Comment&#160;</td>
				</tr>
			</tbody>
		</table>
	</div>
	<p>&#160;</p>
	<p>
		<strong>Operation ID: <span style="color: rgb(255, 0, 0);">GET-CARD-VALUE</span><br /></strong>
	</p>
	<p>
		<strong>Description: </strong>Returns the value of a form field.
	</p>
	<p>
		<strong>Return:</strong> character
	</p>
	<p>
		<strong>Parameters:</strong>
	</p>
	<div class="table-wrap">
		<table class="confluenceTable">
			<tbody>
				<tr>
					<th class="confluenceTh">Name</th>
					<th class="confluenceTh">Type</th>
					<th class="confluenceTh">Description</th>
				</tr>
				<tr>
					<td class="confluenceTd">processInstanceId</td>
					<td class="confluenceTd">integer</td>
					<td class="confluenceTd">Process code</td>
				</tr>
				<tr>
					<td class="confluenceTd">fieldName</td>
					<td class="confluenceTd">character</td>
					<td class="confluenceTd">Name of form field</td>
				</tr>
			</tbody>
		</table>
	</div>
	<p>&#160;</p>
	<p>
		<strong>Operation ID: <span style="color: rgb(255, 0, 0);">SAVE-AND-SEND-TASK</span><br /></strong>
	</p>
	<p>
		<strong>Description: </strong>Moves the request to the next activity.<strong><br /></strong>
	</p>
	<p>
		<strong>Return:</strong> TempTable
	</p>
	<p>
		<strong>Parameters:</strong>
	</p>
	<div class="table-wrap">
		<table class="confluenceTable">
			<tbody>
				<tr>
					<th class="confluenceTh">Name</th>
					<th class="confluenceTh">Type</th>
					<th class="confluenceTh">Description</th>
					<th class="confluenceTh">Details</th>
				</tr>
				<tr>
					<td class="confluenceTd">processInstanceId</td>
					<td class="confluenceTd">integer</td>
					<td class="confluenceTd">Process code</td>
					<td class="confluenceTd">&#160;</td>
				</tr>
				<tr>
					<td colspan="1" class="confluenceTd">colleagueIds</td>
					<td colspan="1" class="confluenceTd">character</td>
					<td colspan="1" class="confluenceTd">Users who will receive
						the task</td>
					<td colspan="1" class="confluenceTd">use character in format:
						"colab1,colab2,colab3"</td>
				</tr>
				<tr>
					<td class="confluenceTd">activityNumber</td>
					<td class="confluenceTd">integer</td>
					<td class="confluenceTd">Activity number</td>
					<td class="confluenceTd">&#160;</td>
				</tr>
				<tr>
					<td colspan="1" class="confluenceTd">comments</td>
					<td colspan="1" class="confluenceTd">character</td>
					<td colspan="1" class="confluenceTd">Comments</td>
					<td colspan="1" class="confluenceTd">&#160;</td>
				</tr>
				<tr>
					<td colspan="1" class="confluenceTd">completeTask</td>
					<td colspan="1" class="confluenceTd">logical</td>
					<td colspan="1" class="confluenceTd">Indicates if the task
						must be completed (true) or only saved (false)</td>
					<td colspan="1" class="confluenceTd">&#160;</td>
				</tr>
				<tr>
					<td colspan="1" class="confluenceTd">ttAttachments</td>
					<td colspan="1" class="confluenceTd">TempTable</td>
					<td colspan="1" class="confluenceTd">Request attachments</td>
					<td colspan="1" class="confluenceTd"><p>DEFINE TEMP-TABLE
							ttAttach</p>
						<p>&#160;&#160;&#160; FIELD documentId AS INTEGER</p>
						<p>&#160;&#160;&#160; FIELD documentVersion AS INTEGER</p>
						<p>&#160;&#160;&#160; FIELD description AS CHARACTER</p>
						<p>&#160; &#160; FIELD filename AS CHARACTER</p>
						<p>&#160;&#160;&#160; FIELD filepath AS CHARACTER</p>
						<p>&#160;&#160;&#160; FIELD principal AS LOGICAL.</p></td>
				</tr>
				<tr>
					<td colspan="1" class="confluenceTd">ttCardData</td>
					<td colspan="1" class="confluenceTd">TempTable</td>
					<td colspan="1" class="confluenceTd">Form data</td>
					<td colspan="1" class="confluenceTd"><p>DEFINE TEMP-TABLE
							ttCard</p>
						<p>&#160; &#160; FIELD fieldName AS CHARACTER</p>
						<p>&#160; &#160; FIELD fieldValue AS CHARACTER.</p></td>
				</tr>
				<tr>
					<td colspan="1" class="confluenceTd">ttAppointment</td>
					<td colspan="1" class="confluenceTd">TempTable</td>
					<td colspan="1" class="confluenceTd">Task annotations</td>
					<td colspan="1" class="confluenceTd"><p>DEFINE TEMP-TABLE
							ttAppointment</p>
						<p>&#160;&#160;&#160; FIELD appointmentDate AS CHARACTER</p>
						<p>&#160;&#160;&#160; FIELD appointmentSeconds AS INTEGER</p>
						<p>&#160; &#160; FIELD appointmentSequence AS INTEGER.</p></td>
				</tr>
				<tr>
					<td colspan="1" class="confluenceTd">managerMode</td>
					<td colspan="1" class="confluenceTd">logical</td>
					<td colspan="1" class="confluenceTd"><p>Indicates whether
							the user is initiating the request as a</p>
						<p>process manager.</p></td>
					<td colspan="1" class="confluenceTd">&#160;</td>
				</tr>
				<tr>
					<td colspan="1" class="confluenceTd">threadSequence</td>
					<td colspan="1" class="confluenceTd">integer</td>
					<td colspan="1" class="confluenceTd"><p>Indicates if there
							is any parallel activity in the process. If there are no
							activities,</p>
						<p>the value is 0 (zero), if there are any, this value can
							range</p>
						<p>from 1 to infinity depending on the amount of parallel</p>
						<p>activities existing in the process.</p></td>
					<td colspan="1" class="confluenceTd">&#160;</td>
				</tr>
			</tbody>
		</table>
	</div>
	<p>&#160;</p>
	<p>
		<strong>Operation ID: <span style="color: rgb(255, 0, 0);">SAVE-AND-SEND-TASK-BY-REPLACEMENT</span><br /></strong>
	</p>
	<p>
		<strong>Description: </strong>Moves the request to the next activity
		using substitute user.<strong><br /></strong>
	</p>
	<p>
		<strong>Return: </strong>TempTable<strong><br /></strong>
	</p>
	<p>
		<strong>Parameters:</strong>
	</p>
	<div class="table-wrap">
		<table class="confluenceTable">
			<tbody>
				<tr>
					<th class="confluenceTh">Name</th>
					<th class="confluenceTh">Type</th>
					<th class="confluenceTh">Description</th>
					<th class="confluenceTh">Details</th>
				</tr>
				<tr>
					<td class="confluenceTd">processInstanceId</td>
					<td class="confluenceTd">integer</td>
					<td class="confluenceTd">Process code</td>
					<td class="confluenceTd">&#160;</td>
				</tr>
				<tr>
					<td colspan="1" class="confluenceTd">colleagueIds</td>
					<td colspan="1" class="confluenceTd">character</td>
					<td colspan="1" class="confluenceTd">Users who will receive
						the task</td>
					<td colspan="1" class="confluenceTd">use character in format:
						"colab1,colab2,colab3"</td>
				</tr>
				<tr>
					<td class="confluenceTd">activityNumber</td>
					<td class="confluenceTd">integer</td>
					<td class="confluenceTd">Activity number</td>
					<td class="confluenceTd">&#160;</td>
				</tr>
				<tr>
					<td colspan="1" class="confluenceTd">comments</td>
					<td colspan="1" class="confluenceTd">character</td>
					<td colspan="1" class="confluenceTd">Comments</td>
					<td colspan="1" class="confluenceTd">&#160;</td>
				</tr>
				<tr>
					<td colspan="1" class="confluenceTd">completeTask</td>
					<td colspan="1" class="confluenceTd">logical</td>
					<td colspan="1" class="confluenceTd">Indicates if the task
						must be completed (true) or only saved (false)</td>
					<td colspan="1" class="confluenceTd">&#160;</td>
				</tr>
				<tr>
					<td colspan="1" class="confluenceTd">ttAttachments</td>
					<td colspan="1" class="confluenceTd">TempTable</td>
					<td colspan="1" class="confluenceTd">Request attachments</td>
					<td colspan="1" class="confluenceTd"><p>DEFINE TEMP-TABLE
							ttAttach</p>
						<p>&#160;&#160;&#160; FIELD documentId AS INTEGER</p>
						<p>&#160;&#160;&#160; FIELD documentVersion AS INTEGER</p>
						<p>&#160;&#160;&#160; FIELD description AS CHARACTER</p>
						<p>&#160; &#160; FIELD filename AS CHARACTER</p>
						<p>&#160;&#160;&#160; FIELD filepath AS CHARACTER</p>
						<p>&#160;&#160;&#160; FIELD principal AS LOGICAL.</p></td>
				</tr>
				<tr>
					<td colspan="1" class="confluenceTd">ttCardData</td>
					<td colspan="1" class="confluenceTd">TempTable</td>
					<td colspan="1" class="confluenceTd">Form data</td>
					<td colspan="1" class="confluenceTd"><p>DEFINE TEMP-TABLE
							ttCard</p>
						<p>&#160; &#160; FIELD fieldName AS CHARACTER</p>
						<p>&#160; &#160; FIELD fieldValue AS CHARACTER.</p></td>
				</tr>
				<tr>
					<td colspan="1" class="confluenceTd">ttAppointment</td>
					<td colspan="1" class="confluenceTd">TempTable</td>
					<td colspan="1" class="confluenceTd">Task annotations</td>
					<td colspan="1" class="confluenceTd"><p>DEFINE TEMP-TABLE
							ttAppointment</p>
						<p>&#160;&#160;&#160; FIELD appointmentDate AS CHARACTER</p>
						<p>&#160;&#160;&#160; FIELD appointmentSeconds AS INTEGER</p>
						<p>&#160; &#160; FIELD appointmentSequence AS INTEGER.</p></td>
				</tr>
				<tr>
					<td colspan="1" class="confluenceTd">managerMode</td>
					<td colspan="1" class="confluenceTd">logical</td>
					<td colspan="1" class="confluenceTd"><p>Indicates whether
							the user is initiating the request as a</p>
						<p>process manager.</p></td>
					<td colspan="1" class="confluenceTd">&#160;</td>
				</tr>
				<tr>
					<td colspan="1" class="confluenceTd">threadSequence</td>
					<td colspan="1" class="confluenceTd">integer</td>
					<td colspan="1" class="confluenceTd"><p>Indicates if there
							is any parallel activity in the process. If</p>
						<p>there are no activities, the value is 0 (zero), if there
							are any, this value</p>
						<p>can range from 1 to infinity depending on the amount of</p>
						<p>parallel activities existing in the process.</p></td>
					<td colspan="1" class="confluenceTd">&#160;</td>
				</tr>
				<tr>
					<td colspan="1" class="confluenceTd">replacementId</td>
					<td colspan="1" class="confluenceTd">character</td>
					<td colspan="1" class="confluenceTd">Registration of the
						substitute user</td>
					<td colspan="1" class="confluenceTd">&#160;</td>
				</tr>
			</tbody>
		</table>
	</div>
	<p>&#160;</p>
	<p>
		<strong>Operation ID: <span style="color: rgb(255, 0, 0);">SET-AUTOMATIC-DECISION</span><br /></strong>
	</p>
	<p>
		<strong>Description: </strong>Selects user(s) and advance automatic
		activity<strong>.<br /></strong>
	</p>
	<p>
		<strong>Return: </strong>TempTable<strong><br /></strong>
	</p>
	<p>
		<strong>Parameters:</strong>
	</p>
	<div class="table-wrap">
		<table class="confluenceTable">
			<tbody>
				<tr>
					<th class="confluenceTh">Name</th>
					<th class="confluenceTh">Type</th>
					<th class="confluenceTh">Description</th>
					<th class="confluenceTh">Details</th>
				</tr>
				<tr>
					<td class="confluenceTd">processInstanceId</td>
					<td class="confluenceTd">integer</td>
					<td class="confluenceTd">Process code</td>
					<td class="confluenceTd">&#160;</td>
				</tr>
				<tr>
					<td class="confluenceTd">autoTaskNum</td>
					<td class="confluenceTd">integer</td>
					<td class="confluenceTd">Automatic activity number</td>
					<td class="confluenceTd">&#160;</td>
				</tr>
				<tr>
					<td class="confluenceTd">taskNum</td>
					<td class="confluenceTd">integer</td>
					<td class="confluenceTd">Current activity number</td>
					<td class="confluenceTd">&#160;</td>
				</tr>
				<tr>
					<td colspan="1" class="confluenceTd">condition</td>
					<td colspan="1" class="confluenceTd">integer</td>
					<td colspan="1" class="confluenceTd">Automatic activity
						condition number</td>
					<td colspan="1" class="confluenceTd">&#160;</td>
				</tr>
				<tr>
					<td colspan="1" class="confluenceTd">colleagueIds</td>
					<td colspan="1" class="confluenceTd">character</td>
					<td colspan="1" class="confluenceTd">Users who will receive
						the task</td>
					<td colspan="1" class="confluenceTd">use character in format:
						"colab1,colab2,colab3"</td>
				</tr>
				<tr>
					<td colspan="1" class="confluenceTd">comments</td>
					<td colspan="1" class="confluenceTd">character</td>
					<td colspan="1" class="confluenceTd">Comments</td>
					<td colspan="1" class="confluenceTd">&#160;</td>
				</tr>
				<tr>
					<td colspan="1" class="confluenceTd">managerMode</td>
					<td colspan="1" class="confluenceTd">logical</td>
					<td colspan="1" class="confluenceTd">Indicates if the user is
						performing the task as a process manager</td>
					<td colspan="1" class="confluenceTd">&#160;</td>
				</tr>
				<tr>
					<td colspan="1" class="confluenceTd">threadSequence</td>
					<td colspan="1" class="confluenceTd">integer</td>
					<td colspan="1" class="confluenceTd"><p>Indicates if there
							is any parallel activity in the process. If there are none, the
							value is 0 (zero),</p>
						<p>if there are any, this value can range from 1 to infinity
							depending on the amount of</p>
						<p>parallel activities existing in the process.</p></td>
					<td colspan="1" class="confluenceTd">&#160;</td>
				</tr>
			</tbody>
		</table>
	</div>
	<p>&#160;</p>
	<p>
		<strong>Operation ID: <span style="color: rgb(255, 0, 0);">TAKE-PROCESS-TASK</span><br /></strong>
	</p>
	<p>
		<strong>Description: </strong>Assumes a task<strong>.<br /></strong>
	</p>
	<p>
		<strong>Return:</strong> character
	</p>
	<p>
		<strong>Parameters:</strong>
	</p>
	<div class="table-wrap">
		<table class="confluenceTable">
			<tbody>
				<tr>
					<th class="confluenceTh">Name</th>
					<th class="confluenceTh">Type</th>
					<th class="confluenceTh">Description</th>
				</tr>
				<tr>
					<td class="confluenceTd">processInstanceId</td>
					<td class="confluenceTd">integer</td>
					<td class="confluenceTd">Process code</td>
				</tr>
				<tr>
					<td class="confluenceTd">threadSequence</td>
					<td class="confluenceTd">integer</td>
					<td class="confluenceTd"><p>Indicates if there is any
							parallel activity in the process. If there are none, the value is
							0 (zero),</p>
						<p>if there are any, this value can range from 1 to infinity
							depending on the amount of</p>
						<p>parallel activities existing in the process.</p></td>
				</tr>
			</tbody>
		</table>
	</div>
	<p>&#160;</p>
	<p>
		<strong>Operation ID: <span style="color: rgb(255, 0, 0);">TAKE-PROCESS-TASK-BY-REPLACEMENT</span><br /></strong>
	</p>
	<p>
		<strong>Description: </strong>Assumes a task using substitute user<strong>.<br /></strong>
	</p>
	<p>
		<strong>Return:</strong> character
	</p>
	<p>
		<strong>Parameters:</strong>
	</p>
	<div class="table-wrap">
		<table class="confluenceTable">
			<tbody>
				<tr>
					<th class="confluenceTh">Name</th>
					<th class="confluenceTh">Type</th>
					<th class="confluenceTh">Description</th>
				</tr>
				<tr>
					<td class="confluenceTd">processInstanceId</td>
					<td class="confluenceTd">integer</td>
					<td class="confluenceTd">Process code</td>
				</tr>
				<tr>
					<td class="confluenceTd">threadSequence</td>
					<td class="confluenceTd">integer</td>
					<td class="confluenceTd"><p>Indicates if there is any
							parallel activity in the process. If there are none, the value is
							0 (zero),</p>
						<p>if there are any, this value can range from 1 to infinity
							depending on the amount of</p>
						<p>parallel activities existing in the process.</p></td>
				</tr>
				<tr>
					<td colspan="1" class="confluenceTd">replacementId</td>
					<td colspan="1" class="confluenceTd">character</td>
					<td colspan="1" class="confluenceTd">Registration of the
						substitute user.</td>
				</tr>
			</tbody>
		</table>
	</div>
	<p>&#160;</p>
	<p>
		<strong>Operation ID: <span style="color: rgb(255, 0, 0);">GET-ATTACHMENTS</span><br /></strong>
	</p>
	<p>
		<strong>Description: </strong>Returns the request attachments<strong><br /></strong>
	</p>
	<p>
		<strong>Return: </strong>TempTable<strong><br /></strong>
	</p>
	<p>
		<strong>Parameters:</strong>
	</p>
	<div class="table-wrap">
		<table class="confluenceTable">
			<tbody>
				<tr>
					<th class="confluenceTh">Name</th>
					<th class="confluenceTh">Type</th>
					<th class="confluenceTh">Description</th>
				</tr>
				<tr>
					<td class="confluenceTd">processInstanceId</td>
					<td class="confluenceTd">integer</td>
					<td class="confluenceTd">Process code</td>
				</tr>
			</tbody>
		</table>
	</div>
	<p>&#160;</p>
	<p>
		<strong>Operation ID: <span style="color: rgb(255, 0, 0);">GET-ALL-ACTIVE-STATES</span><br /></strong>
	</p>
	<p>
		<strong>Description: </strong>Returns the activity number where the
		request is.
	</p>
	<p>
		<strong>Return:</strong> TempTable
	</p>
	<p>
		<strong>Parameters:</strong>
	</p>
	<div class="table-wrap">
		<table class="confluenceTable">
			<tbody>
				<tr>
					<th class="confluenceTh">Name</th>
					<th class="confluenceTh">Type</th>
					<th class="confluenceTh">Description</th>
				</tr>
				<tr>
					<td class="confluenceTd">processInstanceId</td>
					<td class="confluenceTd">integer</td>
					<td class="confluenceTd">Process code</td>
				</tr>
			</tbody>
		</table>
	</div>
	<p>&#160;</p>
	<p>
		<strong>Operation ID: <span style="color: rgb(255, 0, 0);">GET-ACTUAL-THREAD</span><br /></strong>
	</p>
	<p>
		<strong>Description:</strong> Returns the thread sequence of a
		request.
	</p>
	<p>
		<strong>Return: </strong>TempTable<strong><br /></strong>
	</p>
	<p>
		<strong>Parameters:</strong>
	</p>
	<div class="table-wrap">
		<table class="confluenceTable">
			<tbody>
				<tr>
					<th class="confluenceTh">Name</th>
					<th class="confluenceTh">Type</th>
					<th class="confluenceTh">Description</th>
				</tr>
				<tr>
					<td class="confluenceTd">processInstanceId</td>
					<td class="confluenceTd">integer</td>
					<td class="confluenceTd">Process code</td>
				</tr>
				<tr>
					<td class="confluenceTd">stateSequence</td>
					<td class="confluenceTd">integer</td>
					<td class="confluenceTd">State sequence</td>
				</tr>
			</tbody>
		</table>
	</div>
	<p>&#160;</p>
	<p>
		<strong>Operation ID: <span style="color: rgb(255, 0, 0);">GET-AVAILABLE-STATES</span><br /></strong>
	</p>
	<p>
		<strong>Description: </strong>Returns the number of the next activity
		in a request<strong>.<br /></strong>
	</p>
	<p>
		<strong>Return: </strong>TempTable<strong><br /></strong>
	</p>
	<p>
		<strong>Parameters:</strong>
	</p>
	<div class="table-wrap">
		<table class="confluenceTable">
			<tbody>
				<tr>
					<th class="confluenceTh">Name</th>
					<th class="confluenceTh">Type</th>
					<th class="confluenceTh">Description</th>
				</tr>
				<tr>
					<td class="confluenceTd">processId</td>
					<td class="confluenceTd">character</td>
					<td class="confluenceTd">Process code</td>
				</tr>
				<tr>
					<td class="confluenceTd">processInstanceId</td>
					<td class="confluenceTd">integer</td>
					<td class="confluenceTd">Process code</td>
				</tr>
				<tr>
					<td class="confluenceTd">threadSequence</td>
					<td class="confluenceTd">integer</td>
					<td class="confluenceTd"><p>Indicates if there is any
							parallel activity in the process. If there are none, the value is
							0 (zero),</p>
						<p>if there are any, this value can range from 1 to infinity
							depending on the amount of</p>
						<p>parallel activities existing in the process.</p></td>
				</tr>
			</tbody>
		</table>
	</div>
	<p>&#160;</p>
	<p>
		<strong>Operation ID: <span style="color: rgb(255, 0, 0);">GET-AVAILABLE-STATES-DETAIL</span><br /></strong>
	</p>
	<p>
		<strong>Description:</strong> Returns details on the activities
		available for selection.
	</p>
	<p>
		<strong>Return: </strong>TempTable<strong><br /></strong>
	</p>
	<p>
		<strong>Parameters:</strong>
	</p>
	<div class="table-wrap">
		<table class="confluenceTable">
			<tbody>
				<tr>
					<th class="confluenceTh">Name</th>
					<th class="confluenceTh">Type</th>
					<th class="confluenceTh">Description</th>
				</tr>
				<tr>
					<td class="confluenceTd">processId</td>
					<td class="confluenceTd">character</td>
					<td class="confluenceTd">Process code</td>
				</tr>
				<tr>
					<td class="confluenceTd">processInstanceId</td>
					<td class="confluenceTd">integer</td>
					<td class="confluenceTd">Process code</td>
				</tr>
				<tr>
					<td class="confluenceTd">threadSequence</td>
					<td class="confluenceTd">integer</td>
					<td class="confluenceTd"><p>Indicates if there is any
							parallel activity in the process. If there are none, the value is
							0 (zero),</p>
						<p>if there are any, this value can range from 1 to infinity
							depending on the amount of</p>
						<p>parallel activities existing in the process.</p></td>
				</tr>
			</tbody>
		</table>
	</div>
	<p>&#160;</p>
	<p>
		<strong>Operation ID: <span style="color: rgb(255, 0, 0);">GET-AVAILABLE-USERS</span><br /></strong>
	</p>
	<p>
		<strong>Description: </strong>Returns users who can perform a current
		task in a request.<strong><br /></strong>
	</p>
	<p>
		<strong>Return: </strong>TempTable<strong><br /></strong>
	</p>
	<p>
		<strong>Parameters:</strong>
	</p>
	<div class="table-wrap">
		<table class="confluenceTable">
			<tbody>
				<tr>
					<th class="confluenceTh">Name</th>
					<th class="confluenceTh">Type</th>
					<th class="confluenceTh">Description</th>
				</tr>
				<tr>
					<td class="confluenceTd">processInstanceId</td>
					<td class="confluenceTd">integer</td>
					<td class="confluenceTd">Process code</td>
				</tr>
				<tr>
					<td class="confluenceTd">taskNumber</td>
					<td class="confluenceTd">integer</td>
					<td class="confluenceTd">Activity number</td>
				</tr>
				<tr>
					<td class="confluenceTd">threadSequence</td>
					<td class="confluenceTd">integer</td>
					<td class="confluenceTd"><p>Indicates if there is any
							parallel activity in the process. If there are none, the value is
							0 (zero),</p>
						<p>if there are any, this value can range from 1 to infinity
							depending on the amount of</p>
						<p>parallel activities existing in the process.</p></td>
				</tr>
			</tbody>
		</table>
	</div>
	<p>&#160;</p>
	<p>
		<strong>Operation ID: <span style="color: rgb(255, 0, 0);">GET-INSTANCE-CARD-DATA</span><br /></strong>
	</p>
	<p>
		<strong>Description: </strong>Returns the field values of form<strong>.<br /></strong>
	</p>
	<p>
		<strong>Return: </strong>TempTable<strong><br /></strong>
	</p>
	<p>
		<strong>Parameters:</strong>
	</p>
	<div class="table-wrap">
		<table class="confluenceTable">
			<tbody>
				<tr>
					<th class="confluenceTh">Name</th>
					<th class="confluenceTh">Type</th>
					<th class="confluenceTh">Description</th>
				</tr>
				<tr>
					<td class="confluenceTd">processInstanceId</td>
					<td class="confluenceTd">integer</td>
					<td class="confluenceTd">Process code</td>
				</tr>
			</tbody>
		</table>
	</div>
	<p>&#160;</p>
	<p>
		<strong>Operation ID: <span style="color: rgb(255, 0, 0);">GET-AVAILABLE-PROCESS</span><br /></strong>
	</p>
	<p>
		<strong>Description:</strong> Returns the processes the user can
		initiate in a request.
	</p>
	<p>
		<strong>Return: </strong>TempTable<strong><br /></strong>
	</p>
	<p>
		<strong><br /></strong>
	</p>
	<p>
		<strong>Operation ID: <span style="color: rgb(255, 0, 0);">GET-AVAILABLE-USERS-START</span><br /></strong>
	</p>
	<p>
		<strong>Description: </strong>Returns the users available in opening a
		request.<br />
		</strong>
	</p>
	<p>
		<strong>Return: </strong>TempTable<strong><br /></strong>
	</p>
	<p>
		<strong>Parameters:</strong>
	</p>
	<div class="table-wrap">
		<table class="confluenceTable">
			<tbody>
				<tr>
					<th class="confluenceTh">Name</th>
					<th class="confluenceTh">Type</th>
					<th class="confluenceTh">Description</th>
				</tr>
				<tr>
					<td class="confluenceTd">processId</td>
					<td class="confluenceTd">character</td>
					<td class="confluenceTd">Process code</td>
				</tr>
				<tr>
					<td class="confluenceTd">taskNum</td>
					<td class="confluenceTd">integer</td>
					<td class="confluenceTd">Activity number</td>
				</tr>
				<tr>
					<td class="confluenceTd">threadSequence</td>
					<td class="confluenceTd">integer</td>
					<td class="confluenceTd"><p>Indicates if there is any
							parallel activity in the process. If there are none, the value is
							0 (zero),</p>
						<p>if there are any, this value can range from 1 to infinity
							depending on the amount of</p>
						<p>parallel activities existing in the process.</p></td>
				</tr>
			</tbody>
		</table>
	</div>
	<p>&#160;</p>
	<p>
		<strong>Operation ID: <span style="color: rgb(255, 0, 0);">SEARCH-PROCESS</span><br /></strong>
	</p>
	<p>
		<strong>Description: </strong>Searches processes available for
		initialization<strong>.<br /></strong>
	</p>
	<p>
		<strong>Return: </strong>TempTable<strong><br /></strong>
	</p>
	<p>
		<strong>Parameters:</strong>
	</p>
	<div class="table-wrap">
		<table class="confluenceTable">
			<tbody>
				<tr>
					<th class="confluenceTh">Name</th>
					<th class="confluenceTh">Type</th>
					<th class="confluenceTh">Description</th>
				</tr>
				<tr>
					<td class="confluenceTd">content</td>
					<td class="confluenceTd">character</td>
					<td class="confluenceTd">Name of the process to be searched</td>
				</tr>
				<tr>
					<td class="confluenceTd">favorite</td>
					<td class="confluenceTd">logical</td>
					<td class="confluenceTd">Search in the favorite list or the
						standard list.</td>
				</tr>
			</tbody>
		</table>
	</div>
	<p>&#160;</p>
	<h3
		id="id-7.InteraçãocomoEnginedeWorkflowAtravésdeFormuláriosMetadados-ExemplodeUso">
		<u>Usage example</u>
	</h3>
	<p>
		Find below an example of a Datasul Metadata Freeform form that
		performs some operations with the <strong>ECM-REQUEST-SERVICE</strong>
		command.
	</p>
	<p>
		<img class="confluence-embedded-image image-center"
			src="http://tdn.totvs.com/download/attachments/81789205/TesteWorkflow1.png?version=1&modificationDate=1381343934000&api=v2"
			data-image-src="http://tdn.totvs.com/download/attachments/81789205/TesteWorkflow1.png?version=1&modificationDate=1381343934000&api=v2">
	</p>
	<p style="text-align: center;">
		<strong>Figure 6.2.a</strong>
	</p>
	<p>
		Figure 6.2.a shows a form that when loaded performs the search for
		available processes for the logged user and presents them in a grid.
		In Figure 6.2.a, the process "Proc3" was selected, which has an
		associated form. The form fields and annotation data were informed.
		Finally, the user clicked the START-PROCESS button, creating a new
		instance of the process, resulting in the <em>process ID</em> 119.
	</p>
	<p>Below, several form scripts are presented.</p>
	<h4
		id="id-7.InteraçãocomoEnginedeWorkflowAtravésdeFormuláriosMetadados-varDefinition">varDefinition</h4>
	<div class="code panel pdl" style="border-width: 1px;">
		<div class="codeContent panelContent pdl">
			<pre class="theme: Eclipse; brush: plain; gutter: true"
				style="font-size: 12px;">/* Start WIDGET-HANDLE - Do not edit, use CTRL + SHIFT + H */
DEFINE VARIABLE txtComment AS WIDGET-HANDLE.
DEFINE VARIABLE txtDescricao AS WIDGET-HANDLE.
DEFINE VARIABLE canvasCard AS WIDGET-HANDLE.
DEFINE VARIABLE txtCodigo AS WIDGET-HANDLE.
DEFINE VARIABLE lblProcList AS WIDGET-HANDLE.
DEFINE VARIABLE canvasAppointment AS WIDGET-HANDLE.
DEFINE VARIABLE lblProcInstId AS WIDGET-HANDLE.
DEFINE VARIABLE lblAttach AS WIDGET-HANDLE.
DEFINE VARIABLE txtProcInstId AS WIDGET-HANDLE.
DEFINE VARIABLE lblApp AS WIDGET-HANDLE.
DEFINE VARIABLE gridProcess AS WIDGET-HANDLE.
DEFINE VARIABLE dtf AS WIDGET-HANDLE.
DEFINE VARIABLE canvasAttach AS WIDGET-HANDLE.
DEFINE VARIABLE txtSec AS WIDGET-HANDLE.
DEFINE VARIABLE lblForm AS WIDGET-HANDLE.
/* End WIDGET-HANDLE */

DEFINE VARIABLE resp AS CHARACTER.
DEFINE VARIABLE ttResult AS TEMP-TABLE.</pre>
		</div>
	</div>
	<h4
		id="id-7.InteraçãocomoEnginedeWorkflowAtravésdeFormuláriosMetadados-Canvas.creationComplete">Canvas.creationComplete</h4>
	<div class="code panel pdl" style="border-width: 1px;">
		<div class="codeContent panelContent pdl">
			<pre class="theme: Eclipse; brush: plain; gutter: true"
				style="font-size: 12px;">PROCESS-WAIT(TRUE).
/* Style arrow for some components */
CALLFUNCTION(lblProcList, "setStyle", "fontSize", 11).
CALLFUNCTION(lblProcList, "setStyle", "fontWeight", "bold").
CALLFUNCTION(lblProcInstId, "setStyle", "fontSize", 11).
CALLFUNCTION(lblProcInstId, "setStyle", "fontWeight", "bold").
CALLFUNCTION(canvasAttach, "setStyle", "backgroundColor", "#d9dbe1").
CALLFUNCTION(lblAttach, "setStyle", "fontSize", 11).
CALLFUNCTION(lblAttach, "setStyle", "fontWeight", "bold").
CALLFUNCTION(canvasCard, "setStyle", "backgroundColor", "#d9dbe1").
CALLFUNCTION(lblForm, "setStyle", "fontWeight", "bold").
CALLFUNCTION(canvasAppointment, "setStyle", "backgroundColor", "#d9dbe1").
CALLFUNCTION(lblApp, "setStyle", "fontWeight", "bold").
 
/* Obtains the processes available for the user */
resp = ECM-REQUEST-SERVICE("WORKFLOW", "GET-AVAILABLE-PROCESSES").
 
if RESULT-WITH-ERROR(resp) THEN DO:
    MESSAGE resp
        VIEW-AS ALERT-BOX ERROR
        TITLE "Error while running GET-AVAILABLE-PROCESS".
ELSE DO:
    ttResult = JSON-DECODE(resp).
    gridProcess:QUERY-OPEN(ttResult).
END.
PROCESS-WAIT(FALSE).</pre>
		</div>
	</div>
	<h4
		id="id-7.InteraçãocomoEnginedeWorkflowAtravésdeFormuláriosMetadados-btoStartProcess.click">btoStartProcess.click</h4>
	<div class="code panel pdl" style="border-width: 1px;">
		<div class="codeContent panelContent pdl">
			<pre class="theme: Eclipse; brush: plain; gutter: true"
				style="font-size: 12px;">DEFINE VARIABLE idx AS INTEGER.
DEFINE VARIABLE processId AS CHARACTER.
DEFINE VARIABLE procComment AS CHARACTER.
DEFINE VARIABLE aux AS CHARACTER.
DEFINE VARIABLE once AS LOGICAL INITIAL true.
DEFINE VARIABLE dt AS DATE.
DEFINE VARIABLE iaux AS INTEGER.
 
/* Obtains the process selected on the Grid */
idx = GETPROPERTY(gridProcess, "selectedIndex").
ttResult:SET-CURRENT(idx).
processId = ttResult.processId.
 
/* Obtains the comment */
procComment = txtComment:SCREEN-VALUE.
 
/* Obtains files to attach from the upload component */
DEFINE VARIABLE upload AS WIDGET-HANDLE.
DEFINE TEMP-TABLE ttFiles
   FIELD name AS CHARACTER
   FIELD type AS CHARACTER
   FIELD appServerPath AS CHARACTER
   FIELD jbossPath AS CHARACTER
   FIELD size AS DECIMAL.
ttFiles = GETPROPERTY(upload,"files").
 
/* Prepares Temp-Table for attachments */
DEFINE TEMP-TABLE ttAttach
   FIELD documentId AS INTEGER
   FIELD documentVersion AS INTEGER
   FIELD description AS CHARACTER
   FIELD filename AS CHARACTER
   FIELD filepath AS CHARACTER
   FIELD principal AS LOGICAL.
 
FOR EACH ttFiles:
    CREATE ttAttach.
    ttAttach.documentVersion = 1000.
    ttAttach.description = ttFiles.name.
    ttAttach.filename = ttFiles.name.
    ttAttach.filepath = ttFiles.jbossPath.
    IF once THEN DO:
       ttAttach.principal = true.
       once = false.
    END.
END.
 
/* Prepares Temp-Table with values from the form */
DEFINE TEMP-TABLE ttCard
   FIELD fieldName AS CHARACTER
   FIELD fieldValue AS CHARACTER.
 
CREATE ttCard.
ttCard.fieldName = "A1_CODIGO".
aux = txtCodigo:SCREEN-VALUE.
ttCard.fieldValue = aux.
 
CREATE ttCard.
ttCard.fieldName = "A1_DESCRICAO".
aux = txtDescricao:SCREEN-VALUE.
ttCard.fieldValue = aux.
 
/* Prepares Temp-Table with values from the Annotation */
DEFINE TEMP-TABLE ttAppointment
   FIELD appointmentDate AS CHARACTER
   FIELD appointmentSeconds AS INTEGER
   FIELD appointmentSequence AS INTEGER.
 
aux = txtSec:SCREEN-VALUE.
IF aux &lt;> "" THEN DO:
   CREATE ttAppointment.
   dt = GETPROPERTY(dtf, "selectedDate").
   aux = STRING(dt, "99/99/9999").
   aux = aux + " 00:00:00".
   ttAppointment.appointmentDate = aux.
   iaux = INTEGER(txtSec:SCREEN-VALUE).
   ttAppointment.appointmentSeconds = iaux.
   ttAppointment.appointmentSequence = 1.
END.
/* Starts the process */
resp = ECM-REQUEST-SERVICE("WORKFLOW", "START-PROCESS", processId, "framework", 2, procComment, true, ttAttach, ttCard, ttAppointment, false).
 
IF RESULT-WITH-ERROR(resp) THEN DO:
    MESSAGE resp
        VIEW-AS ALERT-BOX ERROR
        TITLE "Error when running START-PROCESS".
ELSE DO:
    txtProcInstId:SCREEN-VALUE = resp.
END.</pre>
		</div>
	</div>
	<p>&#160;</p>
	<h4
		id="id-7.InteraçãocomoEnginedeWorkflowAtravésdeFormuláriosMetadados-btoCancelProcess.click">btoCancelProcess.click</h4>
	<div class="code panel pdl" style="border-width: 1px;">
		<div class="codeContent panelContent pdl">
			<pre class="theme: Eclipse; brush: plain; gutter: true"
				style="font-size: 12px;">DEFINE VARIABLE processInstId AS INTEGER.
processInstId = INTEGER(txtProcInstId:SCREEN-VALUE).
 
/* If cancellation Ok, it returns ' true ', if not, it returns the error message */
resp = ECM-REQUEST-SERVICE("WORKFLOW", "CANCEL-PROCESS", processInstId, "Finaliza processo!").
 
IF RESULT-WITH-ERROR(resp) THEN DO:
    MESSAGE resp
        VIEW-AS ALERT-BOX ERROR
        TITLE "Error while running GET-AVAILABLE-PROCESS".
ELSE DO:
    MESSAGE "Process successfully cancelled!"
        VIEW-AS ALERT-BOX INFORMATION
        TITLE "CANCEL-PROCESS".
    txtProcInstId:SCREEN-VALUE = "".
END.</pre>
		</div>
	</div>
	<h4
		id="id-7.InteraçãocomoEnginedeWorkflowAtravésdeFormuláriosMetadados-btoGetCardData.click">btoGetCardData.click</h4>
	<div class="code panel pdl" style="border-width: 1px;">
		<div class="codeContent panelContent pdl">
			<pre class="theme: Eclipse; brush: plain; gutter: true"
				style="font-size: 12px;">DEFINE VARIABLE procInstId AS INTEGER.
procInstId = INTEGER(txtProcInstId:SCREEN-VALUE).
 
/* Obtains one field at a time: GET-CARD-VALUE
resp = ECM-REQUEST-SERVICE("WORKFLOW", "GET-CARD-VALUE", procInstId, "A1_CODIGO").
 
IF RESULT-WITH-ERROR(resp) THEN DO:
    MESSAGE resp
        VIEW-AS ALERT-BOX ERROR
        TITLE "Error when running GET-CARD-VALUE".
ELSE DO:
    txtCodigo:SCREEN-VALUE = resp.
END.
 
resp = ECM-REQUEST-SERVICE("WORKFLOW", "GET-CARD-VALUE", procInstId, "A1_DESCRICAO").
 
IF RESULT-WITH-ERROR(resp) THEN DO:
    MESSAGE resp
        VIEW-AS ALERT-BOX ERROR
        TITLE "Error when running GET-CARD-VALUE".
ELSE DO:
    txtDescricao:SCREEN-VALUE = resp.
END. */
 
/* Obtains all fields from the form: GET-INSTANCE-CARD-DATA */
resp = ECM-REQUEST-SERVICE("WORKFLOW", "GET-INSTANCE-CARD-DATA", procInstId).
 
DEFINE VARIABLE ttCard AS TEMP-TABLE.
DEFINE VARIABLE fieldName AS CHARACTER.
DEFINE VARIABLE fieldValue AS CHARACTER.
 
IF RESULT-WITH-ERROR(resp) THEN DO:
    MESSAGE resp
        VIEW-AS ALERT-BOX ERROR
        TITLE "Error when running GET-INSTANCE-CARD-DATA".
ELSE DO:
    ttCard = JSON-DECODE(resp).
    FOR EACH ttCard:
        fieldName = ttCard.fieldName.
        fieldValue = ttCard.fieldValue.
 
        IF fieldName = "A1_CODIGO" THEN DO:
            txtCodigo:SCREEN-VALUE = fieldValue.
        END.
        IF fieldName = "A1_DESCRICAO" THEN DO:
            txtDescricao:SCREEN-VALUE = fieldValue.
        END.
    END.
END.</pre>
		</div>
	</div>
	<h4
		id="id-7.InteraçãocomoEnginedeWorkflowAtravésdeFormuláriosMetadados-btoAvailableUsers.click">btoAvailableUsers.click</h4>
	<div class="code panel pdl" style="border-width: 1px;">
		<div class="codeContent panelContent pdl">
			<pre class="theme: Eclipse; brush: plain; gutter: true"
				style="font-size: 12px;">DEFINE VARIABLE procInstId AS INTEGER.
procInstId = INTEGER(txtProcInstId:SCREEN-VALUE).
/* Obtains a user list for the task */
resp = ECM-REQUEST-SERVICE("WORKFLOW", "GET-AVAILABLE-USERS", procInstId, 2, 0).
 
DEFINE VARIABLE ttUsers AS TEMP-TABLE.
IF RESULT-WITH-ERROR(resp) THEN DO:
    MESSAGE resp
        VIEW-AS ALERT-BOX ERROR
        TITLE "Error when running GET-AVAILABLE-USERS".
ELSE DO:
    ttUsers = JSON-DECODE(resp).
    FOR EACH ttUsers:
        DISPLAY ttUsers.user.
    END.
END.</pre>
		</div>
	</div>
	<h4
		id="id-7.InteraçãocomoEnginedeWorkflowAtravésdeFormuláriosMetadados-btoTakeTask.click">btoTakeTask.click</h4>
	<div class="code panel pdl" style="border-width: 1px;">
		<div class="codeContent panelContent pdl">
			<pre class="theme: Eclipse; brush: plain; gutter: true"
				style="font-size: 12px;">DEFINE VARIABLE procInstId AS INTEGER.
/* Obtains the process instance Id */
procInstId = INTEGER(txtProcInstId:SCREEN-VALUE).
/* Assumes current task */
resp = ECM-REQUEST-SERVICE("WORKFLOW", "TAKE-PROCESS-TASK", procInstId, 0).
IF RESULT-WITH-ERROR(resp) THEN DO:
    MESSAGE resp
        VIEW-AS ALERT-BOX ERROR
        TITLE "Error when running TAKE-PROCESS-TASK".
ELSE DO:
    DISPLAY resp.
END.</pre>
		</div>
	</div>
</div>