Workflows can automatically generate email alerts and alerts within SAP Business One. This configuration allows users to receive emails or native B1 notifications when their attention is needed to perform follow-up tasks.

Creating Alerts

Alerts are created by modifying workflows using the Workflow Portal for Interconnect. To create or update an alert:

  1. Log into Workflow Portal as an employee web user with Workflow Admin access.

  2. Open Manage Workflows > Workflows and edit the desired workflow. For reference, each Workflow “File Name” field includes the EDI document number.

  3. Add your desired notifications to the workflow, adding the notification section within an action, as shown in the example below.

    Alert Notification Syntax Definition

    The following table defines the available properties for alerts within SAP Business ne and by email.

    Syntax:

    <Notifications>
         <!-- Up to two Notifications may be specified for SPS, one for SPS_SUCCESS and one for SPS_FAIL. You may chose to omit one or both notification definitions. -->
         <Notification Name="[SPS_SUCCESS|SPS_FAIL]" Enabled="[true|false]" UserToNotify="<user-id>" B1Alert="[true|false]" EmailAlert="[true|false]" Subject="<subject-with-or-without-doc-id-parameter-{0}>" />
    </Notifications>
    
    Workflow Notification Properties
    Property Definition

    Name

    [SPS_SUCCESS|SPS_FAIL]

    SPS_SUCCESS: This option indicates that the message alert will be sent on successful execution of the SPS Cloud EDI workflow.

    SPS_FAIL: This option indicates that the message alert will be sent when the SPS Cloud EDI workflow fails.

    Enabled

    [true|false]: If true, the specified alerts will be sent.

    Set this option to false if a valid UserToNotify is not configured, otherwise an error will occur upon workflow execution.

    Set this option to false If B1Alert and EmailAlert are both false, otherwise an error will occur upon workflow execution.

    UserToNotify

    Specifies the user ID of a valid B1 user who should receive notifications. A valid B1 user ID is required for all enabled notifications, however, it will not be evaluated for disabled notifications.

    B1Alert

    [true|false]: If true an alert notification is created in SAP Business One for the specified user.

    EmailAlert

    [true|false] If true a notification is sent by email to the specified user.

    Subject

    This subject name will be used in the alert. It may include the document key by using {0}. For example: Subject="New SPS Sales Order Imported (PO {0})"

    Workflow Sample Code for Alert Notifications

    This code sample demonstrates alerts added to 850 Inbound Orders. The highlighted section indicates that there is a B1 alert sent to “manager” upon success, and a B1 alert sent to “manager” upon failure, with no email notifications enabled.

    <?xml version="1.0" encoding="utf-16"?>
    <WorkFlow xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Trace="ON">
        <Header>
            <Name>SPSOrder_Inbound_850</Name>
            <Description>SPSOrder_Inbound_850</Description>
            <Settings />
        </Header>
        <RetrySettings AllowRetry="true" MaxRetries="3" IntervalInMinutes="5" RetryFolder="RETRY" MaxRetryFailFolder="FAILURE" RetrySuccessFolder="SUCCESS" />
        <MessageSource xsi:type="SFTP_SPS_EDI" ConfigurationName="SFTPConfig" InputFolder="./testout" FilePrefix="SAPH02" DefaultFailFolder="FAILURE" />
        <Schedule Type="Polling" WaitTimeInSeconds="300" />
        <Branches>
             <Branch Name="ImportSPSOrder">
                 <Actions>
                     <Action xsi:type="SPS_Order" B1KeyXpath="BOM" Method="insert" B1ObjectType="oOrders" TransformXSLT="Empty.xslt">
                         <Notifications>
                             <Notification Name="SPS_SUCCESS" Enabled="false" UserToNotify="manager" B1Alert="true" EmailAlert="false" Subject="New SPS Sales Order Imported (PO {0})" />
                             <Notification Name="SPS_FAIL" Enabled="true" UserToNotify="manager" B1Alert="true" EmailAlert="false" Subject="Failed SPS Sales Order Import (PO {0})" />
                         </Notifications>
                     </Action>
                 </Actions>
             </Branch>
         </Branches>
    </WorkFlow>
    
  4. Save your workflow edits.

  5. Recycle the Workflow Service for your SAP Business One company.

    To do this:

    1. Open the Windows Services screen on the server where the Workflow Service is installed (typically the SAP Business One server). To do this, in your Windows Start menu, search for Services, then right-click and run Services as Administrator.
    2. Scroll to the bottom until you find zedB1WorkFlowService.
    3. Restart the zedB1WorkFlowService.
  6. Going forward, users will see alert notifications as defined in the workflow.