feat(salesforce): Implement create attachment integration
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
import defineAction from '../../../../helpers/define-action';
|
||||
|
||||
export default defineAction({
|
||||
name: 'Create attachment',
|
||||
key: 'createAttachment',
|
||||
description:
|
||||
'Creates an attachment of a specified object by given parent ID.',
|
||||
arguments: [
|
||||
{
|
||||
label: 'Parent ID',
|
||||
key: 'parentId',
|
||||
type: 'string' as const,
|
||||
required: true,
|
||||
variables: true,
|
||||
description:
|
||||
'ID of the parent object of the attachment. The following objects are supported as parents of attachments: Account, Asset, Campaign, Case, Contact, Contract, Custom objects, EmailMessage, EmailTemplate, Event, Lead, Opportunity, Product2, Solution, Task',
|
||||
},
|
||||
{
|
||||
label: 'Name',
|
||||
key: 'name',
|
||||
type: 'string' as const,
|
||||
required: true,
|
||||
variables: true,
|
||||
description: 'Name of the attached file. Maximum size is 255 characters.',
|
||||
},
|
||||
{
|
||||
label: 'Body',
|
||||
key: 'body',
|
||||
type: 'string' as const,
|
||||
required: true,
|
||||
variables: true,
|
||||
description: 'File data. (Max size is 25MB)',
|
||||
},
|
||||
],
|
||||
|
||||
async run($) {
|
||||
const { parentId, name, body } = $.step.parameters;
|
||||
|
||||
const options = {
|
||||
ParentId: parentId,
|
||||
Name: name,
|
||||
Body: body,
|
||||
};
|
||||
|
||||
const { data } = await $.http.post(
|
||||
'/services/data/v56.0/sobjects/Attachment/',
|
||||
options
|
||||
);
|
||||
|
||||
$.setActionItem({ raw: data });
|
||||
},
|
||||
});
|
@@ -1,10 +1,9 @@
|
||||
import defineAction from '../../../../helpers/define-action';
|
||||
|
||||
export default defineAction({
|
||||
name: 'Find Record',
|
||||
name: 'Find record',
|
||||
key: 'findRecord',
|
||||
description:
|
||||
'Finds a record of a specified object by a field and value.',
|
||||
description: 'Finds a record of a specified object by a field and value.',
|
||||
arguments: [
|
||||
{
|
||||
label: 'Object',
|
||||
|
@@ -1,3 +1,4 @@
|
||||
import findRecord from './find-record';
|
||||
import createAttachment from './create-attachment';
|
||||
|
||||
export default [findRecord];
|
||||
export default [findRecord, createAttachment];
|
||||
|
@@ -1,7 +1,9 @@
|
||||
---
|
||||
favicon: /favicons/salesforce.svg
|
||||
items:
|
||||
- name: Find Record
|
||||
- name: Create attachment
|
||||
desc: Creates an attachment of a specified object by given parent ID.
|
||||
- name: Find record
|
||||
desc: Finds a record of a specified object by a field and value.
|
||||
---
|
||||
|
||||
|
Reference in New Issue
Block a user