+
+

Lab 2: Create an Autolaunched Flow for SAP synchronization (Optional)

Overview

  1. During this lab you will start from the following Autolaunched Flow draft version to avoid going through repetitive tasks.

    module6 auto flow draft
  2. At the end you will have a fully working flow as follow.

    module6 auto flow complete

Step 1: Create a copy of the Autolaunched Flow (No Trigger)

  1. Login into the Salesforce Developer ORG and access the Setup menĂ¹.

    module6 setup menu
  2. Search for Flows in the Quick Find text field and click Flows under Process Automation.

    module6 quick find flows
  3. Select the Orchestration Lab’s Flows list view from the drop down menu in the top left section.

    module6 flow lab list view
  4. Click the LAB - AUTO - Update Order in SAP (Draft) flow label link from the list.

    module6 sap draft auto flow link
  5. Once the flow is opened click the Save As button on the top right.

    module6 save as flow
  6. Select Save as A New Flow and provide My LAB - AUTO - Update Order in SAP as Flow Label. Click outside the label field and the Flow API Name should appear automatically.

    Click the Save button.

    module6 save as auto flow

Step 2: Analize the pre-built flow

  1. Click on the Get Order Update CASE element and click Edit Element.

    module6 auto flow get case edit btn

    As you can see this element is in charge of retrieving the order update case with the Id provided as input to the flow with the caseId variable. This step is required to retrive the identifier of the order referenced by the case.

    module6 auto flow get case conf
  2. Click Cancel to close the window.

  3. Click on the Get Salesforce ORDER element and click Edit Element. Looking at the Get Records element configration you can see its goal is to retrieve the order referenced by the case retrieved at the previous step.

    module6 auto flow get order conf
  4. Click Cancel to close the window.

Step 3: Add "Set Request Payload" Assignment Flow Element

  1. Open the Toolbox with the Toogle Toolbox button on the top-left.

    module6 toogle toolbox btn
  2. Click New Resource to add a new variable.

    module6 new resource btn
  3. Select Variable form the drop down list as Resource Type. Compile the remaining fileds as follow.

    Field Value

    API Name

    requestPayload

    Data Type

    Apex-Defined

    Apex Class

    ExternalService__SAPSystemAPI100_putOrders_IN_generated

  4. Click Done.

    module6 sap req pay res wiz
  5. Click the Add element button after the Get Salesforce ORDER element.

    module6 add element btn
  6. Search for `Assignment' and select it.

    module6 add assignment ele
  7. In the New Assignment modal enter Set request payload as Label and SetRequestPayload as API Name.

  8. Compile the Variable Values as follow.

    Variable Operator Value

    {!requestPayload.REQx5fDATEx5fH}

    Equals

    {!sapShippingDate}

    {!requestPayload.SALESDOCUMENT}

    Equals

    {!Get_ORDER.SAP_Id__c}

    {!requestPayload.SALESx5fORG}

    Equals

    3000

    {!requestPayload.DISTRx5fCHAN}

    Equals

    10

    {!requestPayload.DIVISION}

    Equals

    00

    {!requestPayload.PURCHx5fNOx5fC}

    Equals

    9191919

    {!requestPayload.SALESx5fDIST}

    Equals

    2222

    module6 auto flow assignment conf
  9. Click Done

Step 4: Add "Update SAP Order" Action Flow Element

  1. Click the Add element button after the Set request payload element.

    module6 add element btn
  2. Search for `Action' and select it.

    module6 add action ele
  3. In the Action field search for externalService-SAP and select the result.

    module6 new action sap
  4. In the New Action modal enter Update SAP Order as Label and UpdateSAPOrder as API Name.

  5. In the input value section select the toggle to include the request payload. The generated field should be now editable. In the generated field enter {!requestPayload}

  6. Expand rhe Advanced Section and check the Manually assign variables. Enter {!responseCode} as responseCode.

    module6 auto flow action conf
  7. Click Done

Step 5: Add "Update Order Update Case" Update Records Flow Element

  1. Click the Add element button after the Update SAP Order element.

    module6 add element btn
  2. Search for Update Records and select it.

    module6 add update records ele
  3. In the New Update Records modal enter Update Order Update CASE as Label and Update_Order_Update_Case as API Name.

  4. Select Specify conditions to identify records, and set fields individually as How to Find Records to Update and Set Their Values.

  5. Select Case as Object.

  6. Compile filter conditions as follow.

    Field Operator Value

    Id

    Equals

    {!caseId}

  7. Compile field values as follow.

    Field Value

    SAPId__c

    {!Get_ORDER.SAP_Id__c}

    module6 auto flow upd rec conf
  8. Click Done

Step 6: Save Autolaunched Flow

  1. Click the Save button in the top-right corner.

    module6 save btn
  2. Click the Activate button in the top-right corner.

    module6 activate btn

Step 7: Debug Autolaunched Flow

  1. Click the Debug button in the top-right corner.

    module6 debug btn
  2. Enter a valid case id retrieved form the Salesforce org on which you are building the flow. The case must be related to the Nina Morris account. Enter one week from today as shipping date.

    module6 auto flow debug wiz
  3. Click Run

  4. In the Debug Details right panel expand the SystemAPI100.putOrders section and look for the response code. If you see a 200 returned as code the flow is working properly.

    module6 auto flow debug det
Submit your feedback!
Share your thoughts to help us build the best workshop experience for you!
Take our latest survey!