Mapping Values to a Custom XML Outbound Integration

Sable Childs
Sable Childs
  • Updated

When mapping values and fields in a custom XML outbound integration, use “dot notation” to define where each value being mapped should be placed in the request body.

(This article assumes that you understand the basics of how XML documents are structured. There are numerous resources and tutorials online that cover the basics of XML data structures.)

XML documents consist of hierarchically organized sets of tagged values. Use dot notation to map the structural path to each value you need to send to the recipient of your LeadConduit flow’s Custom XML outbound step.

It’s probably easiest to see how dot notation works by looking at an example. Here’s a typical XML request body:

<?xml version="1.0" encoding="UTF-8"?>
<root>
  <lead>
    <Acode>D80731</Acode>
    <FirstName>**first_name**</FirstName>
    <LastName>**last_name**</LastName>
    <HSGraduationYear>** graduation_year **</HSGraduationYear>
  </lead>
  <phones>
    <PhoneNumber>**phone_1**</PhoneNumber>
    <PhoneType>3</PhoneType>
  </phones>
  <phones>
    <PhoneNumber>**phone_2**</PhoneNumber>
    <PhoneType>1</PhoneType>
  </phones>
  <leadEmail>**email**</leadEmail>
  <address>
    <Line1>**address_1**</Line1>
    <City>**city**</City>
    <State>**state**</State>
    <Country>US</Country>
    <Zip>**postal_code**</Zip>
  </address>
  <passcode>cjdujwofpf</passcode>
  <programTypeCode>**program_of_interest**</programTypeCode>
</root>

Note that it consists of a root object that is a wrapper for several child XML objects (, , ,

, , and ) each of which may wrap a simple value (as do , , ), or child objects (as do and
) or an array of child objects (as does ).

To map a value to a simple object like , set the recipient field type to “Xml Path”, and map the path by simply linking the names of each wrapping object with a dot, beginning with the outermost and working inward: root.leadEmail or, for FirstName: root.lead.FirstName

When there are multiple instances of same-named objects inside the same wrappers, such as of which there are two distinct but similar instances, each of which has as its value an set of one or more child objects ( and ), treat the objects as an array of complex objects. Represent each by a numeric subscript that relates the components of each instance. For instance, to map phone_1, the path for that object’s phoneNumber would be root.phones.0.PhoneNumber and the path for that object’s phoneType would be root.phones.0.PhoneType. Similarly, for phone_2 the paths would be root.phones.1.PhoneNumber and root.phones.1.PhoneType. Subscripts must be assigned sequentially beginning with zero.

Here is an example of what the mappings for the above XML request body would look like in LeadConduit:

Image

Image

XML attributes are mapped using an “@” before the attribute name. Here’s what the objects above would look like if the PhoneType was an attribute instead of a child object.

  <phones>
    <PhoneNumber PhoneType="3">**phone_1**</PhoneNumber>
  </phones>
  <phones>
    <PhoneNumber PhoneType="1">**phone_2**</PhoneNumber
  </phones>

And here is how that section would be mapped:

Image

What if you need to send an an array of same-named XML properties that are distinguished by their attributes? For example:

Image

Simply add .#text onto the end of the value mapping. Add a period after the array number in the attribute mapping. So here is how the above sample XML request would be mapped:

Image

Wrapping XML data in <![CDATA ]]> Tags

<![CDATA[ ]]> tags are supported by putting #cdata at the end of the mapping’s XMLpath.

For example, These mappings produce a plain XML request body:

Image

Image

Adding #cdata to the mapping wraps the data in <![CDATA[ ]]> tags:

Image

Image

Was this article helpful?

0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.