File Upload

Operation Name

File Upload

Function Overview

This operation is upload/update a file to the ContentVersion.
After uploading, you can also retrieve the ContentDocument ID of the uploaded file.

You can retrieve the results of each record corresponding to the input data from the output schema.

Refer to File Upload usage example for an example of using this operation.

This operation uses the following API. With regarding to the API specification utilized by this operation, please refer to the version of the API document, selected for the global resource, in the below-mentioned link.

Data Model

The data model of this component is the Table Model type.

Properties

For information about using variables, refer to "variables".
Basic Settings
Item name Required/Optional Use of Variables Description Supplement
Name Required Not Available Enter the name that appears on the script canvas.  
Input Data Required Not Available Select the component on the script canvas.  
Required Settings
Item name Required/Optional Use of Variables Description Supplement
Destination Required Not Available Select Global Resources.
  • [Add...]:
    Add new global resource.
  • [Edit...]:
    Global resource settings can be edited by [Edit Resource list].
  • Available for the resource type is API 43.0 or later.
  • This component has global resource properties that are not affected. For details, please refer to Unaffected global resource property.
Schema definition Required - Set items subject to writing to the ContentVersion of Salesforce.
  • Limiting the settings to only items needed to be written to Salesforce (deleting unnecessary items from the Schema Definition) helps improve processing performance.
  • When [PATCH] is selected in [HTTP Method], the items selected in [External ID field] must be set.
  • For a sample configuration, please refer to File Upload usage example.
Schema definition/Label Required Not Available Display the lable name of the column.  
Schema definition/API Required Not Available Display the API name of the column.  
Schema definition/Type Required Not Available Display the data type of the column.  
Relationship definition Optional - In the case that relationship items exist in the Schema Definition, set items subject to updating by external key.
By selecting the external key item of the relation counterpart object, it becomes possible to pass data with an established relationship.
Relationship definition/Base field Required Not Available Display the API Name of the row of the relation item.  
Relationship definition/Relationship name Required Not Available Display the relationship name of the row of the relation item.  
Relationship definition/Related Object Optional Not Available Select the API Name of the relation counterpart object in the relation item column.  
Relationship definition/Foreign key field Optional Not Available Select the external key item of the relation counterpart object in the relation item column.
  • If omitted, the ID of the relevant record of the relation counterpart object will be passed.
Property Action
Item name Description Supplement
Create schema... The items to be read from Salesforce can be added/deleted.
For setting methods, please refer to "Create Schema."
 
Option Settings
Item name Required/Optional Use of Variables Description Supplement
HTTP Method Required Not Available Select the HTTP method to use with the REST API.
  • [POST]:(default)
    Execute the request using the HTTP POST method.
  • [PATCH]:
    Execute the request using the HTTP PATCH method.
  • If you are creating a new record, select [POST].
    • Examples:
      • Upload a new file
      • Add a new version of a file
  • If you want to update the record, select [PATCH].
    • Examples:
      • Update file titles and descriptions
      • Insert/Update(Upsert) Record using External ID (or ID)
  • For a sample configuration, please refer to File Upload usage example.
External ID field Optional Not Available Select the external ID field to be the key for the update process.
  • This becomes valid and required when [PATCH] is selected for the [HTTP Method].
  • Selected [External ID field] must be set to [Schema definition].
Handling of null values Optional Not Available If the input data for the field to be updated is null, choose whether to overwrite with null or skip the update of that item.
  • [Field value to null]:(default)
    If the input data is null, overwrite the field to be updated with null.
  • [Skip null values]:
    If the input data is null, the update of the field to be updated is skipped and the state before the update is maintained.
    If the input data is not null, the field being updated is overwritten with the input data.
  • This becomes valid when [PATCH] is selected for the [HTTP Method].
Getting ContentDocumentId Optional Not Available Select whether to get the ContentDocument ID of the uploaded file.
  • [Checked]:(default)
    Get the ContentDocumentId.
  • [Not Checked]:
    Do not get the ContentDocumentId.
  • If [Checked] was selected, the acquired ContentDocumentId can be passed onto the subsequent processing as Table Model type data.
  • For details, please refer to Get ContentDocumentId.
Property Action
Item name Description Supplement
Read schema definition from file... Select a file from the file chooser and read the name of field API on the first line of the file specified in the comma-separated values. Set this as the schema definition.
  • Please specify "UTF-8" encoding for the selected file.
Large Data Processing Settings
Item name Required/Optional Use of Variables Description Supplement
Large Data Processing Required Not Available Select a Large Data Processing Settings.
  • [Use the setting in the script]:(default)
    Apply Large Data Processing Settings settings of script property to adapter.
  • [Disable Large Data Processing]:
    Large Data Processing is not performed.
  • [Enable Large Data Processing]:
    Large Data Processing is performed.
 
Comment
Item name Required/Optional Use of Variables Description Supplement
Comment Optional Not Available You can write a short description of this adapter.
The description will be reflected in the specifications.
 

Schema

Input Schema

The number of columns varies depending on the [Schema definition] settings.

Output Schema

Information regarding the results of file upload will appear in the column, set in the [Schema definition].

<?xml version="1.0" encoding="UTF-8" ?>
<table>
  <row>
    <column>API set in the [Schema definition]</column>
       :
    <column>result_id</column>
    <column>result_is_success</column>
    <column>result_is_created</column>
    <column>result_error_status_code</column>
    <column>result_error_message</column>
    <column>result_row_number</column>
    <column>result_content_document_id</column>
  </row>
  <row>
    :
  </row>
</table>
Element Name Column Name Description Supplement
row
-
Repeats as many times as the number of data given to the input schema.
column result_id ContentVersion ID is output.
  • Output only when a new record is created.
result_is_success Success Flag is output.
  • [true]:Successfully processed
  • [false]Process failedPlease check the[result_error_status_code] as well as [result_error_message].
 
result_is_created Create Flag is output.
  • [true]:A record is created.
  • [false]:No record is created.
 
result_error_status_code The status code, returned by the Salesforce API, is output.
  • In the below-mentioned case, the Salesforce adapter will output the code and message.
    • SALESFORCE_ADAPTER_ILLEGAL_DATA_TYPE
      Set when the defined item type and input data type do not match. For example, if the item is defined as "date" but a character string is input (not a date).
result_error_message The message returned by the Salesforce API is output.
result_row_number Number is output based on the placement of the node within the data given to the input schema.  
result_content_document_id Output the ContentDocumentId of the ContentVersion.
  • If [Getting ContentDocumentId] is [Not Checked], it will be null.
  • Even if [Getting ContentDocumentId] is set to [Checked], it may be null.
    For details, please refer to Getting ContentDocumentId.

Reading Schema by Mapper

The schema will be read automatically.

Large Data Processing

Large Data Processing is supported.

Transaction

Transaction is not supported.

Usage on PSP Script

Cannot be used on PSP Script.

Available Component variables

Component Variable Name Description Supplement
insert_count The number of data that was successful in the addition processing is stored.
  • The default value is null.
update_count The number of data that was successful in the updating processing is stored.
  • The default value is null.
error_count The number of data that was unsuccessful in the addition/updating processing is stored.
  • The default value is null.
read_count The number of input data is stored.
  • The default value is null.
server_url The end point URL after Login is stored.
  • The default value is null.
session_id The session Id is stored.
  • The default value is null.
message_category In the case that an error occurs, the category of the message code corresponding to the error is stored.
  • The default value is null.
message_code In the case that an error occurs, the code of the message code corresponding to the error is stored.
  • The default value is null.
message_level In the case that an error occurs, the importance of the message code corresponding to the error is stored.
  • The default value is null.
operation_error_message If an error occurs, the error message of the occured error is stored.
  • The default value is null.
  • The content to be stored may change according to the version of DataSpider Servista.
operation_error_trace When an error occurs, the trace information of the occured error is stored.
  • The default value is null.
  • The content to be stored may change according to the version of DataSpider Servista.

Relationship definition

By taking in this setting, the automatical obtainment and updating of the ID of the record which responds to the external key, becomes possible by passing the value of the external key item of the reference object.

Create Schema

The data items to be written into Salesforce can be specified in the creation of a schema.
By specifying only the items indispensable for processing, the data traffic to Salesforce can be reduced, generally improving the processing performance.
When writing into Salesforce (adding or updating), it is necessary to make sure that the items "Not Creatable" and "Not Updatable" are not be chosen.



Number in the Image Name Description Supplement
(1) Selected Fields Select items for writing to Salesforce.  
(2) UnSelected Fields Select items not for writing to Salesforce.
  • You can filter fields by inputting or selecting values from the input above the column name.
    Text fields will be filtered as Starting With the input value.

File Upload usage example

An example is shown below.
For details on the ContentVersion object, please refer to the version of the API document, selected for the global resource, in the below-mentioned link.

Getting ContentDocumentId

By doing this setting, you get the ContentDocumen ID of the uploaded file.
ContentDocumen ID is then stored in the [result_content_document_id] for the output schema and can be subsequently passed as data of the table model type.
If select [PATCH] for [HTTP Method] and an existing record is updated, [result_content_document_id] in the output schema will be null.

Unaffected global resource property

This component refers to global resource property and uploads files using REST API.
The following settings are unaffected because they are properties related to the SOAP API.
For details, please refer toGlobal Resource Property.
Option Settings
Item name Supplement
Field value truncation
  • It is not affected.
  • If the input data is too large, the update will fail and print "STRING _TOO_LONG" to [result_error_status_code] in the output schema.

SOAP Header Setting
Item name Supplement
AllOrNone Header
(allOrNone)
  • It is not affected.
  • File Upload executes one REST API for each input data. In case of multiple input data, input data without error is committed, but input data with error is stored in the output schema.
Email Header
(triggerAutoResponseEmail)
  • It is not affected.
Email Header
(triggerOtherEmail)
Email Header
(triggerUserEmail)
Mru Header
(updateMru)
  • It is not affected.
AssignmentRule Header
(useDefaultRule)
  • It is not affected.
  • File Upload executes the REST API so that a valid AssignmentRule is applied.
    • Assignment rule ID cannot be specified.
    • For details, please refer to the "AssignmentRuleHeader" page of the API document "REST API Developer's Guide".
AssignmentRule Header
(assignmentRuleId)
DisableFeedTracking Header
(disableFeedTracking)
  • It is not affected.
DuplicateRule Header
(allowSave)
  • It is not affected.

Specification Limits

Main exceptions

Exception Name Reason Resolution
ResourceNotFoundException
Resource Definition is Not Found. Name:[]
[Destination] is not specified. Specify [Destination].
ResourceNotFoundException
Resource Definition is Not Found. Name:[<Global Resource Name>]
The resource definition selected in [Destination] cannot be found. Verify the global resource specified in [Destination]
java.net.UnknownHostException This exception occurs when the PROXY server specified in the global resource cannot be found. Verify the condition of the PROXY server. Or verify [Proxy host] of the global resource specified in the [Destination].
java.net.SocketTimeoutException
connect timed out
A time-out has occurred while connecting to Salesforce. Verify the network condition and Salesforce server condition. Or check [Connection timeout(sec)] of the global resource specified in the [Destination].
java.net.SocketTimeoutException
Read timed out
A time-out has occurred while waiting for a responce from the server after connecting to Salesforce. Verify the network condition and Salesforce server condition. Or check [Timeout(sec)] of the global resource specified in the [Destination].
jp.co.headsol.salesforce.adapter.exception.SalesforceAdapterIllegalArgumentException Invalid value is set for the property of Salesforce adapter. Check the error message, and verify the settings.
com.sforce.soap.partner.fault.LoginFault Login to Salesforce has failed. Check the ExceptionCode or error message, and refer to the information about this type of error in Salesforce-related documents etc.
com.sforce.soap.partner.fault.UnexpectedErrorFault An unexpected error has occured while processing to Salesforce. Check the ExceptionCode or error message, and refer to the information about this type of error in Salesforce-related documents etc.

Notes