---
schema_version: "1"
id: 6de859f44c9b627ddc8463640c52b95f42acad225b59b698395108b210e78a35
title: Extract Payload Information to Variables
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/anypoint-code-builder/tut-slack-extract-payload-information.md
canonical_url: https://docs.mulesoft.com/anypoint-code-builder/tut-slack-extract-payload-information
source_site: docs.mulesoft.com
content_type: documentation
content_hash: cdb59b6a4213f5656c6dca729706e9f0e02864d3748889f6cd40526b78ae0f78
description: MuleSoft Documentation Site
latest: true
---
---
product: Anypoint Code Builder
version: master
---

# Extract Payload Information to Variables

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

This section of the tutorial teaches you how to extract information from the payload into different
variables to refer to those values later in the flow.

## Before You Begin

Complete these procedures:

- [Integrate Salesforce Data into Slack and Email Notifications](https://docs.mulesoft.com/anypoint-code-builder/tut-slack-create-escalation-api).

- [Create a Configuration File for Slack and Salesforce](https://docs.mulesoft.com/anypoint-code-builder/tut-slack-create-config-files-sfdc).

- Configure your Salesforce integration.

## Extract Values From the Payload

1.  In Anypoint Code Builder, open your `new-case-salesforce.xml` file.

2.  Click the ![](/mulesoft/current/en-us/anypoint-code-builder/_images/icon-plus.png) (**Add component**) icon after the **On New Case**
    Salesforce component:

    ![A flow in the canvas UI with the \*Add Component\* button highlighted](/mulesoft/current/en-us/anypoint-code-builder/_images/add-transform-from-canvas-slack.png)

3.  Type `Transform` and select **Transform**.

4.  Configure the Transform Message component to extract data from the payload to variables:

    ```XML
    <ee:transform doc:name="Extract Values from Case" >
        <ee:variables>
          <ee:set-variable variableName="casestatus"> (1)
              <![CDATA[%dw 2.0 output application/java --- payload.Status]]>
          </ee:set-variable>
          <ee:set-variable variableName="casenumber"> (2)
              <![CDATA[%dw 2.0 output application/java --- payload.CaseNumber]]>
          </ee:set-variable>
    <ee:set-variable variableName="slackchannel"> (3)
              <![CDATA["this-is-a-test"]]>
          </ee:set-variable>
        </ee:variables>
      </ee:transform>
    ```

    <table><tbody><tr><td><i data-value="1"></i><b>1</b></td><td><code>casestatus</code> retrieves the Salesforce case status: <strong>New</strong>, <strong>Working</strong>, or <strong>Escalated</strong>.</td></tr><tr><td><i data-value="2"></i><b>2</b></td><td><code>casenumber</code> retrieves the case number created by Salesforce.</td></tr><tr><td><i data-value="3"></i><b>3</b></td><td>Set the <code>slackchannel</code> to the channel name that you set earlier in the tutorial.</td></tr></tbody></table>

## Concatenate Your Values in The Payload

Add a Set Payload component to concatenate the value of your variables in the resulting payload of
your application:

1.  Click the ![](/mulesoft/current/en-us/anypoint-code-builder/_images/icon-plus.png) (**Add component**) icon after the Transform Message
    component:

    ![A flow in the canvas UI with the \*Add Component\* button highlighted](/mulesoft/current/en-us/anypoint-code-builder/_images/add-set-payload-slack-case-canvas.png)

2.  Type `set` and select **Set Payload**.

3.  Configure the Set Payload component with the following code:

    ```XML
    <set-payload doc:name="Set Case Info" value='#["Case Number: " ++ (payload.CaseNumber default "") ++  ", Origin: " ++ (payload.Origin default "") ++ ", Case Type: " ++ (payload.Type default "") ++ ", Priority: " ++ (payload.Priority default "") ++ ", Status: " ++ (payload.Status default "")]'/>
    ```

4.  Proceed to [Add a Condition to Your Flow Logic](https://docs.mulesoft.com/anypoint-code-builder/tut-slack-add-condition-to-your-flow) to create
    a condition to send an email if the case is escalated or otherwise inform about the case in a
    Slack channel.

[Create a Configuration File for Slack and Salesforce](https://docs.mulesoft.com/anypoint-code-builder/tut-slack-create-config-files-sfdc)
[Add a Condition to Your Flow Logic](https://docs.mulesoft.com/anypoint-code-builder/tut-slack-add-condition-to-your-flow)
