Standard Workflow Setup for InterConnect


First published on: 08/10/2023/6:54 pm

 

 

Workflows can be used to asynchronously update data in SAP Business One. Workflow Configuration is outlined below, which applies business logic to how to handle creation and updates of data within SAP Business One. Examples of Workflows are provided that outline the steps to configure workflows for common business logic.

 

Once a workflow has been executed, it may succeed, or it may encounter business exceptions that prevent the workflow from being successfully processed. Refer to Workflow Maintenance for InterConnect for details on how to monitor workflow status.

 

Steps to Configure a Workflow

A workflow can be set up as follows:

 

  1. Log onto the Workflow Portal (see the screenshot below). Set up an employee user with the WorkFlowAdmin role for the Work Flow Admin Portal application. If the user is already configured to work with Employee Portal, then the same username and password will be used by both portals.

    Log into the Workflow Portal using a configured Employee User.

     

  2. Create a workflow using the New Workflows link. See marker 1 in the screenshot below.

    Navigate to New Workflows (1) and enter a Name (2) and File Name (3). Enable the workflow by placing a checkmark in the Active checkbox (4). Save to apply changes (5).

     

  3. Enter workflow details including WorkFlow Name and WorkFlow File Name as shown by markers 2 and 3 in the screenshot above. Note that the WorkFlow File Name cannot be changed via the workflow Portal after it has been saved, so make sure the file name is unique and meaningful to an admin user.

  4. Configure the Workflow content (see the Examples below or refer to the Workflow API).

  5. Set the active flag. When the workflow is ready for use, check off the Active flag (marker 4 above); if it isn’t ready for deployment, leave the workflow inactive by leaving the Active checkbox unchecked.

  6. Save workflow changes. When changes are complete, use the Save button to apply these changes (see marker 5 above).

 

Workflow Examples

Examples of common workflows that can be used are listed below. For a comprehensive list of other workflow configuration properties, see our Workflow API.

 

Example: Processing an order from a third-party system

This example shows how to set up a workflow to process orders that are saved to a specific folder as XML files. This would be the type of situation that you might see with order files created by Amazon or Magento systems. An overview of the flow of this scenario is as follows:

 

 

Workflow for processing an order from a third-party system.

 

  1. Using a third-party system (such as an Amazon or Magento web store), a customer places an order online. This order cannot be processed until it has been loaded into SAP Business One (B1), so the end goal of this Workflow is for the order to be automatically loaded into B1.
  2. The third-party system generates an XML order, which needs to be added into B1. This order is saved as an XML file by the third-party application.
  3. The XML file, which was formatted by the third-party web store, is in the wrong format for SAP Business One. This requires that the XML file be transformed, using XSLT, into a compatible format. To accomplish this, the Workflow Service detects that an XML file exists, and applies the necessary transform. This results in a new XML file that is compatible with B1.
  4. The newly-transformed XML file (produced by the XSLT applied by the Workflow Service), can now be loaded into B1 by the workflow.
  5. At this point, the order is in SAP Business One.

 

Configuration

To configure a workflow for the above example, perform the following steps:

  • Go to the New Workflow page.
  • Enter My Workflow for the Workflow Name and myWorkflow.xml for the Workflow File Name.
  • Enable the Active checkbox.
  • Enter following XML details for the body of the Workflow:

 


xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Trace="ON">

AllowRetry="true" MaxRetries="3" IntervalInMinutes="5" RetryFolder="RETRY" MaxRetryFailFolder="FAILURE" RetrySuccessFolder="SUCCESS" />
xsi:type="LocalXmlFile" InputFolder="C:\example\incoming" OutputFolder="C:\example\processed" SplitterXPath="" />
Type="Polling" WaitTimeInSeconds="10" />

Name="ImportB1ARInvoice">

xsi:type="B1Object" B1KeyXpath="BOM" Method="insert" B1ObjectType="oOrders" CopyToFolder="SUCCESS" ExceptionFolder="FAILURE" TransformXSLT="Empty.xslt" />


 

 

This creates a workflow that looks for a localXmlFile (set using MessageSource xsi:type) found in the folder C:/example/incoming/ (set using MessageSource InputFolder). The file gets transformed using the XSLT Empty.xslt (set using Action TransformXSLT), found in the Workflow folder /service/xml/xslt/, which is the default location for XSLT files.

 

  • Create the custom XSLT file specified in the Action properties. Go to New Workflow XSLTs. Set the Workflow Xslt File to Empty.xslt (to match the Action TransformXSLT setting of the workflow). Set the contents of the XSLT to the following. Also test out alternative XSLTs, such as the commented section of the code sample:


xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
name="RAWDATE"/>
match="/">
select="*"/>


 

  • The following files are sample orders taken from the OEC Computers database. order_good.xml is a valid order (for OEC Computers) that will be successfully processed. order_fail_BP_not_exist.xml is an order that is syntactically valid, but contains an unknown BP Card Code, and so will cause a failure. Download InterConnect_order_samples.zip.

 

Place these two order XML files in the Input Folder (set in the MessageSource InputFolder) C:/example/incoming/. This will cause the Workflow to execute and process the two files.

 

Note that these samples are for OEC Computers demo database. A valid order XML file can be generated for any system using B1WebAPI. See How to get valid B1 XML samples using InterConnect.

 

 

 

Previous

Next


  

Last modified: 11/13/2023/11:14 pm

 

-