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: [ 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', displayName: 'Link To Object ID',
name: 'linkToObjectId', name: 'linkToObjectId',

View file

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