Merge pull request #1785 from automatisch/make-stages-dynamic-in-pipedrive

feat(pipedrive/create-deal): add dynamic stages
This commit is contained in:
Ali BARIN
2024-04-03 00:09:46 +02:00
committed by GitHub
3 changed files with 40 additions and 30 deletions

View File

@@ -64,32 +64,17 @@ export default defineAction({
value: '1', value: '1',
description: description:
'The ID of the stage this deal will be added to. If omitted, the deal will be placed in the first stage of the default pipeline.', 'The ID of the stage this deal will be added to. If omitted, the deal will be placed in the first stage of the default pipeline.',
options: [ variables: true,
{ source: {
label: 'Qualified (Pipeline)', type: 'query',
value: 1, name: 'getDynamicData',
}, arguments: [
{ {
label: 'Contact Made (Pipeline)', name: 'key',
value: 2, value: 'listStages',
}, },
{ ],
label: 'Prospect Qualified (Pipeline)', },
value: 3,
},
{
label: 'Needs Defined (Pipeline)',
value: 4,
},
{
label: 'Proposal Made (Pipeline)',
value: 5,
},
{
label: 'Negotiations Started (Pipeline)',
value: 6,
},
],
}, },
{ {
label: 'Owner', label: 'Owner',

View File

@@ -1,23 +1,25 @@
import listActivityTypes from './list-activity-types/index.js'; import listActivityTypes from './list-activity-types/index.js';
import listCurrencies from './list-currencies/index.js'; import listCurrencies from './list-currencies/index.js';
import listDeals from './list-deals/index.js'; import listDeals from './list-deals/index.js';
import listLeads from './list-leads/index.js';
import listLeadLabels from './list-lead-labels/index.js'; import listLeadLabels from './list-lead-labels/index.js';
import listOrganizations from './list-organizations/index.js'; import listLeads from './list-leads/index.js';
import listOrganizationLabelField from './list-organization-label-field/index.js'; import listOrganizationLabelField from './list-organization-label-field/index.js';
import listOrganizations from './list-organizations/index.js';
import listPersonLabelField from './list-person-label-field/index.js'; import listPersonLabelField from './list-person-label-field/index.js';
import listPersons from './list-persons/index.js'; import listPersons from './list-persons/index.js';
import listStages from './list-stages/index.js';
import listUsers from './list-users/index.js'; import listUsers from './list-users/index.js';
export default [ export default [
listActivityTypes, listActivityTypes,
listCurrencies, listCurrencies,
listDeals, listDeals,
listLeads,
listLeadLabels, listLeadLabels,
listOrganizations, listLeads,
listOrganizationLabelField, listOrganizationLabelField,
listOrganizations,
listPersonLabelField, listPersonLabelField,
listPersons, listPersons,
listStages,
listUsers, listUsers,
]; ];

View File

@@ -0,0 +1,23 @@
export default {
name: 'List stages',
key: 'listStages',
async run($) {
const stages = {
data: [],
};
const { data } = await $.http.get('/api/v1/stages');
if (data.data?.length) {
for (const stage of data.data) {
stages.data.push({
value: stage.id,
name: stage.name,
});
}
}
return stages;
},
};