In this article
Overview
You can use this Snap to convert binary data at the input view to document data at the output view.
Snap Type
Binary to Document Snap is a TRANSFORM-type Snap that transforms binary data to document data.
Prerequisites
None.
Support for Ultra Pipelines
Works in Ultra Pipelines if Ignore empty string is not set.
Limitations
This Snap can receive multiple binary streams. If you select BYTE_ARRAY in the Encode or Decode drop-down list, then the maximum limit for each input binary stream is 2GB. This limit is much lower for other options and depends on the pattern of the input data.
Known Issues
None.
Prerequisites
None.
Support for Ultra Pipelines
Does not support Ultra Pipelines.
Snap Views
Type | Format | Number of Views | Examples of Upstream and Downstream Snaps | Description |
---|---|---|---|---|
Input | Binary |
|
| Any Snap with a binary output view. |
Output | Document
|
|
|
|
Error | Error handling is a generic way to handle errors without losing data or failing the Snap execution. You can handle the errors that the Snap might encounter while running the Pipeline by choosing one of the following options from the When errors occur list under the Views tab. The available options are:
Learn more about Error handling in Pipelines. |
Snap Settings
Asterisk (*): Indicates a mandatory field.
Suggestion icon (): Indicates a list that is dynamically populated based on the configuration.
Expression icon (): Indicates whether the value is an expression (if enabled) or a static value (if disabled). Learn more about Using Expressions in SnapLogic.
Add icon ( ): Indicates that you can add fields in the field set.
Remove icon (): Indicates that you can remove fields from the field set.
Field Name | Field Type | Description |
---|---|---|
Label* Default Value: Binary to Document | String | Specify the name for the Snap. You can modify this to be more specific, especially if you have more than one of the same Snap in your Pipeline. |
Encode or Decode* Default value: ENCODE_BASE64 | Dropdown list | Select if the content should be encoded or decooded. The options are:
If the input "content" data has already been Base64-encoded and ENCODE_BASE64 is selected, the Snap does not encode the content again. In the same way, if the input "content" data has not been Base64-encoded and DECODE_BASE64 is selected, the Snap does not attempt to decode the content.
|
Ignore empty stream Default value: Deselected | Checkbox | Select this checkbox to enable the Snap to ignore the incoming data stream when no document is received in the input view. |
Snap Execution Default Value: Validate & Execute | Dropdown list | Select one of the three modes in which the Snap executes. Available options are:
|
Example
Uploading a PDF File Attachment to a Salesforce Account Record
To upload a PDF file attachment to a Salesforce Account record, prepare a pipeline of File Reader Snap + Binary to Document Snap + Mapper (Data) Snap + Structure Snap + Salesforce Create Snap.
File Reader Snap: Enter a pdf file URL in the File property.
Binary to Document Snap: Select "ENCODE_BASE64" for the Encode or Decode property.
Mapper (Data) Snap: Enter one row of "$Id" in the Target path property and an ID of an existing Account SObject record.
Structure Snap: Mapping table property
Source Path | Operation | Target Path |
---|---|---|
$original.content-location | move | $Name |
$Id | move | $Id |
$original.content-type | move | $ContentType |
$content | move | $Body |
Salesforce Create Snap: Enter "Attachment" in the Object type property.
The following pipeline reads the binary data from the upstream and converts it into document data in the output preview.
The File Reader Snap reads the binary data to be converted: | The output preview when ENCODE_BASE64 is selected: |
The output preview when NONE is selected: | The output preview when DECODE_BASE64 is selected: |
The output preview when DOCUMENT is selected: | The output preview when BYTE_ARRAY is selected: |