Á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">
	<h1
		id="id-2.2Processo-ComocriarumprocessonoECMapartirdoMicrosigaProtheus">How
		to create a process in ECM using Microsiga Protheus</h1>
	<p>Processes can be created in ECM through the tool itself. Below
		we describe how to accomplish that using Microsiga Protheus
		customization.</p>
	<p>In order to create a process from Microsiga Protheus, we can use
		the WF Wizard from the configurator module, or create a
		customization.&#160;</p>
	<p>Below we describe how to create using a customization</p>
	<ol>
		<li>Configure the integration for the workflow between Protheus
			and ECM in the Configurator, in the <em>Environment > Totvs ECM
				> WF Wizard</em> option
		</li>
		<li>Use the <strong>FWECMProcess</strong> function to create
			and/or update the process in ECM, as shown below:
		</li>
	</ol>
	<p>&#160;</p>
	<blockquote>
		<p align="left" style="margin-left: 30.0px;">#include "totvs.ch"</p>
		<p align="left" style="margin-left: 30.0px;">User Function
			ProcCliente()</p>
		<p align="left" style="margin-left: 30.0px;">Local cProcessId :=
			"CLIENT"</p>
		<p align="left" style="margin-left: 30.0px;">Local cDescription :=
			"Customer file"</p>
		<p align="left" style="margin-left: 30.0px;">Local cInstruction :=
			"Process use instructions"</p>
		<p align="left" style="margin-left: 30.0px;">Local nFormId := 22
			// card index id added to ECM in previous step</p>
		<p align="left" style="margin-left: 30.0px;">Local aStates :=
			Array(4,6) // process activities in sequence for automatic flow
			creation</p>
		<p align="left" style="margin-left: 30.0px;">Local aEvents :=
			Array(1,2) // events that will be customized for the process</p>
		<p align="left" style="margin-left: 30.0px;">Local aProperties :=
			Array(1,2) // properties that will be used in process event scripts</p>
		<p align="left" style="margin-left: 30.0px;">Local aError</p>
		<p align="left">&#160;</p>
		<p align="left" style="margin-left: 30.0px;">aStates[1][1] :=
			"Start" // activity</p>
		<p align="left" style="margin-left: 30.0px;">aStates[1][2] := ""
			// description</p>
		<p align="left" style="margin-left: 30.0px;">aStates[1][3] := ""
			// instructions</p>
		<p align="left" style="margin-left: 30.0px;">aStates[1][4] := 60
			// conclusion deadline in seconds</p>
		<p align="left" style="margin-left: 30.0px;">aStates[1][5] := 0 //
			assignment mechanism (zero for none, 1 for group or 2 for user)</p>
		<p align="left" style="margin-left: 30.0px;">aStates[1][6] := ""
			// group or user code in ECM in case the assignment mechanism is
			different from zero</p>
		<p align="left">&#160;</p>
		<p align="left" style="margin-left: 30.0px;">aStates[2][1] :=
			"Review" // activity</p>
		<p align="left" style="margin-left: 30.0px;">aStates[2][2] :=
			"Review of customer file" // description</p>
		<p align="left" style="margin-left: 30.0px;">aStates[2][3] :=
			"Review file information" // instructions</p>
		<p align="left" style="margin-left: 30.0px;">aStates[2][4] := 60
			// conclusion deadline in seconds</p>
		<p align="left" style="margin-left: 30.0px;">aStates[2][5] := 0 //
			assignment mechanism (zero for none, 1 for group or 2 for user)</p>
		<p align="left" style="margin-left: 30.0px;">aStates[2][6] := ""
			// group or user code in ECM in case the assignment mechanism is
			different from zero</p>
		<p align="left">&#160;</p>
		<p align="left" style="margin-left: 30.0px;">aStates[3][1] :=
			"End" // activity</p>
		<p align="left" style="margin-left: 30.0px;">aStates[3][2] :=
			"Confirm file" // description</p>
		<p align="left" style="margin-left: 30.0px;">aStates[3][3] := ""
			// instructions</p>
		<p align="left" style="margin-left: 30.0px;">aStates[3][4] := 60
			// conclusion deadline in seconds</p>
		<p align="left" style="margin-left: 30.0px;">aStates[3][5] := 0 //
			assignment mechanism (zero for none, 1 for group or 2 for user)</p>
		<p align="left" style="margin-left: 30.0px;">aStates[3][6] := ""
			// group or user code in ECM in case the assignment mechanism is
			different from zero</p>
		<p align="left">&#160;</p>
		<p align="left" style="margin-left: 30.0px;">aEvents[1][1] :=
			"beforeTaskSave"</p>
		<p align="left" style="margin-left: 30.0px;">// JavaScript
			language script</p>
		<p align="left" style="margin-left: 30.0px;">aEvents[1][2] :=
			'function beforeTaskSave(colleagueId,nextSequenceId,userList){'+;</p>
		<p align="left" style="margin-left: 30.0px;">'var A1_COD =
			hAPI.getCardValue("A1_COD");'+;</p>
		<p align="left" style="margin-left: 30.0px;">'if (A1_COD ==
			""){'+;</p>
		<p align="left" style="margin-left: 30.0px;">'&#160;&#160; throw
			"Code field is mandatory"'+;</p>
		<p align="left" style="margin-left: 30.0px;">'}'+;</p>
		<p align="left" style="margin-left: 30.0px;">'}'</p>
		<p align="left">&#160;</p>
		<p align="left" style="margin-left: 30.0px;">aProperties[1][1] :=
			"TABLE" // property name</p>
		<p align="left" style="margin-left: 30.0px;">aProperties[1][2] :=
			"SA1" // value</p>
		<p align="left">&#160;</p>
		<p align="left" style="margin-left: 30.0px;">
			<strong>FWECMProcess(cProcessId, cDescription, cInstruction,
				nFormId, aStates, aEvents, aProperties)</strong>
		</p>
		<p align="left" style="margin-left: 30.0px;">If FWWFIsError()</p>
		<p align="left" style="margin-left: 30.0px;">&#160;&#160; aError
			:= FWWFGetError()</p>
		<p align="left" style="margin-left: 30.0px;">&#160;&#160;
			MsgStop(aError[2])</p>
		<p align="left" style="margin-left: 30.0px;">Else</p>
		<p align="left" style="margin-left: 30.0px;">&#160;&#160;
			MsgInfo("Process updated successfully")</p>
		<p align="left" style="margin-left: 30.0px;">EndIf</p>
		<p align="left" style="margin-left: 30.0px;">Return</p>
	</blockquote>
</div>