Make it possible to sent fileExtension on Salesforce Document

upload
This commit is contained in:
Jan Oberhauser 2021-09-05 14:27:47 +02:00
parent 674313e0c4
commit 5de93a7db1
2 changed files with 11 additions and 3 deletions

View file

@ -85,6 +85,14 @@ export const documentFields = [
},
},
options: [
{
displayName: 'File Extension',
name: 'fileExtension',
type: 'string',
default: '',
placeholder: 'pdf',
description: 'File extension to use. If none is set, the value from the binary data will be used.',
},
{
displayName: 'Link To Object ID',
name: 'linkToObjectId',

View file

@ -1687,7 +1687,7 @@ export class Salesforce implements INodeType {
const binaryData = items[i].binary![binaryPropertyName];
const dataBuffer = await this.helpers.getBinaryDataBuffer(i, binaryPropertyName);
body.entity_content['PathOnClient'] = `${title}.${binaryData.fileExtension}`;
body.entity_content['PathOnClient'] = `${title}.${additionalFields.fileExtension || binaryData.fileExtension}`;
data = {
entity_content: {
value: JSON.stringify(body.entity_content),
@ -1698,11 +1698,11 @@ export class Salesforce implements INodeType {
VersionData: {
value: dataBuffer,
options: {
filename: binaryData.fileName,
contentType: binaryData.mimeType,
filename: body.entity_content['PathOnClient'],
},
},
};
} else {
throw new NodeOperationError(this.getNode(), `The property ${binaryPropertyName} does not exist`);
}