feat(pipedrive): add create organization action
This commit is contained in:
@@ -4,6 +4,7 @@ import listDeals from './list-deals';
|
||||
import listLeads from './list-leads';
|
||||
import listLeadLabels from './list-lead-labels';
|
||||
import listOrganizations from './list-organizations';
|
||||
import listOrganizationLabelField from './list-organization-label-field';
|
||||
import listPersons from './list-persons';
|
||||
import listUsers from './list-users';
|
||||
|
||||
@@ -14,6 +15,7 @@ export default [
|
||||
listLeads,
|
||||
listLeadLabels,
|
||||
listOrganizations,
|
||||
listOrganizationLabelField,
|
||||
listPersons,
|
||||
listUsers,
|
||||
];
|
||||
|
@@ -0,0 +1,34 @@
|
||||
import { IGlobalVariable, IJSONObject } from '@automatisch/types';
|
||||
|
||||
export default {
|
||||
name: 'List organization label field',
|
||||
key: 'listOrganizationLabelField',
|
||||
|
||||
async run($: IGlobalVariable) {
|
||||
const labelFields: {
|
||||
data: IJSONObject[];
|
||||
} = {
|
||||
data: [],
|
||||
};
|
||||
|
||||
const { data } = await $.http.get(
|
||||
`${$.auth.data.apiDomain}/api/v1/organizationFields`
|
||||
);
|
||||
|
||||
const labelField = data.data.filter(
|
||||
(field: IJSONObject) => field.key === 'label'
|
||||
);
|
||||
const labelOptions = labelField[0].options;
|
||||
|
||||
if (labelOptions?.length) {
|
||||
for (const label of labelOptions) {
|
||||
labelFields.data.push({
|
||||
value: label.id,
|
||||
name: label.label,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return labelFields;
|
||||
},
|
||||
};
|
Reference in New Issue
Block a user