Sample Workflow File

The general form of a workflow XML file is as follows:

<?xml version="1.0"?>
<!--edited with XML Spy v3.5 NT (http://www.xmlspy.com) (Tibco) -->
<!--Cancel Workflow.
$Revision: 70941 $
-->
<Workflow Version = "1.3" xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation = "Workflow.xsd">
  <Owner>TIBCO</Owner>
  <Name>cancelworkflowv1</Name>
  <Description>Sub process for event cancellation</Description>
  <Parameter direction = "in" name = "inDoc" type = "document" eval = "variable">1</Parameter>
  <Parameter direction = "out" name = "outDoc1" type = "document" eval = "variable"/>
  <Activity Name = "CloseAllWorkitems">
    <Start/>
    <Action>ManageWorkItem</Action>
    <Description lang = "en">Close all the open workitems and set the status to Cancelled</Description>
    <Execution>SYNCHR</Execution>
    <Parameter direction = "in" eval = "constant" type = "string" name = "WorkItemAction">CLOSE</Parameter>
    <Parameter direction = "in" eval = "constant" type = "string" name = "WorkItemStatus">CANCELLED</Parameter>
    <Parameter direction = "in" name = "InDocument" type = "document" eval = "variable">inDoc</Parameter>
  </Activity>
  <!--End of Add approlva loop -->
  <Activity Name = "SetStatusToCancelled">
    <Action>UpdateEvent</Action>
    <Description lang = "en">Set the event state to Cancelled/Done.</Description>
    <Parameter direction = "in" name = "eventStatus" type = "string" eval = "constant">CANCELLED</Parameter>
    <Parameter direction = "in" type = "string" eval = "constant" name = "eventState">DONE</Parameter>
  </Activity>
  <Activity Name = "SetStatusToError">
    <Action>UpdateEvent</Action>
    <Description lang = "en">Set the event state to Error/Done</Description>
    <Parameter direction = "in" name = "eventStatus" type = "string" eval = "constant">ERROR</Parameter>
    <Parameter direction = "in" type = "string" eval = "constant" name = "eventState">DONE</Parameter>
  </Activity>
  <Activity Name = "UpdateRecordStateAsRejected">
    <Action>UpdateRecordState</Action>
    <Description lang = "en">Set the record status as rejected</Description>
    <Parameter direction = "in" name = "Status" type = "string" eval = "constant">REJECTED</Parameter>
    <Parameter direction = "in" name = "InDocument" type = "document" eval = "variable">inDoc</Parameter>
  </Activity>
  <Activity Name = "RejectDueToWorkflowError">
    <Action>Send</Action>
    <Description lang = "en">Error occured during workflow     processing</Description>
    <Parameter direction = "in" eval = "rule" source = "Message or Workflow Completion" type = "string" name = "Protocol">inDoc</Parameter>
    <Parameter direction = "in" eval = "rule" source = "Message or Workflow Completion" type = "long" name = "Address">inDoc</Parameter>
    <Parameter direction = "in" name = "Sender" type = "string" eval = "constant">support@tibco.com</Parameter>
    <Parameter direction = "in" name = "Presentation" type = "string" eval = "constant">
    com.tibco.mdm.ui.workflow.engine.emailtemplates.EmailProductE ditWorkflowError</Parameter>
    <Parameter direction = "in" eval = "constant" type = "string" name = "Form">standard/forms/fm26ca.xml</Parameter>
    <Parameter direction = "in" type = "document" eval = "variable" name = "InDocument">inDoc</Parameter>
  </Activity>
  <!--Determining whether this is modify or delete-->
  <Transition FromActivity = "CloseAllWorkitems" ToActivity = "UpdateRecordStateAsRejected">
    <Description>If type is CatEdit only, then set the record status as rejected</Description>
    <Rule>
      <Parameter direction = "in" name = "doctype" type = "string" eval = "xpath" source = "/Message/Body/Document/@type">inDoc</Parameter>
      <Parameter direction = "in" name = "inputParamString" eval = "constant" type = "string">CatEdit</Parameter>
      <Parameter name = "result" type = "boolean" direction = "out"/>
      <Condition format = "java">
        <![CDATA[
com.tibco.mdm.workflow.engine.transition.WfSharedConditionTransition.equalsIgnoreCase(doctype, inputParamString);
      </Condition>
    </Rule>
  </Transition>
  <Transition FromActivity = "CloseAllWorkitems" ToActivity = "SetStatusToCancelled"/>
  <Transition FromActivity = "UpdateRecordStateAsRejected" ToActivity = "SetStatusToCancelled"/>
  <Transition type = "error" FromActivity = "Any" ToActivity = "RejectDueToWorkflowError"/>
  <Transition FromActivity = "RejectDueToWorkflowError" ToActivity = "SetStatusToError"/>
</Workflow>