feat(vtiger-crm): add create case action
This commit is contained in:
@@ -0,0 +1,408 @@
|
|||||||
|
export const fields = [
|
||||||
|
{
|
||||||
|
label: 'Summary',
|
||||||
|
key: 'summary',
|
||||||
|
type: 'string',
|
||||||
|
required: true,
|
||||||
|
description: '',
|
||||||
|
variables: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Record Currency',
|
||||||
|
key: 'recordCurrency',
|
||||||
|
type: 'dropdown',
|
||||||
|
required: false,
|
||||||
|
description: '',
|
||||||
|
variables: true,
|
||||||
|
source: {
|
||||||
|
type: 'query',
|
||||||
|
name: 'getDynamicData',
|
||||||
|
arguments: [
|
||||||
|
{
|
||||||
|
name: 'key',
|
||||||
|
value: 'listRecordCurrencies',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Case Title',
|
||||||
|
key: 'caseTitle',
|
||||||
|
type: 'string',
|
||||||
|
required: true,
|
||||||
|
description: '',
|
||||||
|
variables: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Status',
|
||||||
|
key: 'status',
|
||||||
|
type: 'dropdown',
|
||||||
|
required: true,
|
||||||
|
description: '',
|
||||||
|
variables: true,
|
||||||
|
source: {
|
||||||
|
type: 'query',
|
||||||
|
name: 'getDynamicData',
|
||||||
|
arguments: [
|
||||||
|
{
|
||||||
|
name: 'key',
|
||||||
|
value: 'listCaseOptions',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'parameters.status',
|
||||||
|
value: 'casestatus',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Priority',
|
||||||
|
key: 'priority',
|
||||||
|
type: 'dropdown',
|
||||||
|
required: true,
|
||||||
|
description: '',
|
||||||
|
variables: true,
|
||||||
|
source: {
|
||||||
|
type: 'query',
|
||||||
|
name: 'getDynamicData',
|
||||||
|
arguments: [
|
||||||
|
{
|
||||||
|
name: 'key',
|
||||||
|
value: 'listCaseOptions',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'parameters.priority',
|
||||||
|
value: 'casepriority',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Contact Name',
|
||||||
|
key: 'contactName',
|
||||||
|
type: 'dropdown',
|
||||||
|
required: false,
|
||||||
|
description: '',
|
||||||
|
variables: true,
|
||||||
|
source: {
|
||||||
|
type: 'query',
|
||||||
|
name: 'getDynamicData',
|
||||||
|
arguments: [
|
||||||
|
{
|
||||||
|
name: 'key',
|
||||||
|
value: 'listContacts',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Organization Name',
|
||||||
|
key: 'organizationName',
|
||||||
|
type: 'dropdown',
|
||||||
|
required: false,
|
||||||
|
description: '',
|
||||||
|
variables: true,
|
||||||
|
source: {
|
||||||
|
type: 'query',
|
||||||
|
name: 'getDynamicData',
|
||||||
|
arguments: [
|
||||||
|
{
|
||||||
|
name: 'key',
|
||||||
|
value: 'listOrganizations',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Group',
|
||||||
|
key: 'group',
|
||||||
|
type: 'dropdown',
|
||||||
|
required: false,
|
||||||
|
description: '',
|
||||||
|
variables: true,
|
||||||
|
source: {
|
||||||
|
type: 'query',
|
||||||
|
name: 'getDynamicData',
|
||||||
|
arguments: [
|
||||||
|
{
|
||||||
|
name: 'key',
|
||||||
|
value: 'listGroups',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Assigned To',
|
||||||
|
key: 'assignedTo',
|
||||||
|
type: 'string',
|
||||||
|
required: false,
|
||||||
|
description: '',
|
||||||
|
variables: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Product Name',
|
||||||
|
key: 'productName',
|
||||||
|
type: 'dropdown',
|
||||||
|
required: false,
|
||||||
|
description: '',
|
||||||
|
variables: true,
|
||||||
|
source: {
|
||||||
|
type: 'query',
|
||||||
|
name: 'getDynamicData',
|
||||||
|
arguments: [
|
||||||
|
{
|
||||||
|
name: 'key',
|
||||||
|
value: 'listProducts',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Channel',
|
||||||
|
key: 'channel',
|
||||||
|
type: 'dropdown',
|
||||||
|
required: false,
|
||||||
|
description: '',
|
||||||
|
variables: true,
|
||||||
|
source: {
|
||||||
|
type: 'query',
|
||||||
|
name: 'getDynamicData',
|
||||||
|
arguments: [
|
||||||
|
{
|
||||||
|
name: 'key',
|
||||||
|
value: 'listCaseOptions',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'parameters.channel',
|
||||||
|
value: 'casechannel',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Resolution',
|
||||||
|
key: 'resolution',
|
||||||
|
type: 'string',
|
||||||
|
required: false,
|
||||||
|
description: '',
|
||||||
|
variables: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Category',
|
||||||
|
key: 'category',
|
||||||
|
type: 'dropdown',
|
||||||
|
required: false,
|
||||||
|
description: '',
|
||||||
|
variables: true,
|
||||||
|
source: {
|
||||||
|
type: 'query',
|
||||||
|
name: 'getDynamicData',
|
||||||
|
arguments: [
|
||||||
|
{
|
||||||
|
name: 'key',
|
||||||
|
value: 'listCaseOptions',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'parameters.category',
|
||||||
|
value: 'impact_type',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Sub Category',
|
||||||
|
key: 'subCategory',
|
||||||
|
type: 'dropdown',
|
||||||
|
required: false,
|
||||||
|
description: '',
|
||||||
|
variables: true,
|
||||||
|
source: {
|
||||||
|
type: 'query',
|
||||||
|
name: 'getDynamicData',
|
||||||
|
arguments: [
|
||||||
|
{
|
||||||
|
name: 'key',
|
||||||
|
value: 'listCaseOptions',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'parameters.subCategory',
|
||||||
|
value: 'impact_area',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Resolution Type',
|
||||||
|
key: 'resolutionType',
|
||||||
|
type: 'dropdown',
|
||||||
|
required: false,
|
||||||
|
description: '',
|
||||||
|
variables: true,
|
||||||
|
source: {
|
||||||
|
type: 'query',
|
||||||
|
name: 'getDynamicData',
|
||||||
|
arguments: [
|
||||||
|
{
|
||||||
|
name: 'key',
|
||||||
|
value: 'listCaseOptions',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'parameters.resolutionType',
|
||||||
|
value: 'resolution_type',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Deferred Date',
|
||||||
|
key: 'deferredDate',
|
||||||
|
type: 'string',
|
||||||
|
required: false,
|
||||||
|
description: 'format: yyyy-mm-dd',
|
||||||
|
variables: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Service Contracts',
|
||||||
|
key: 'serviceContracts',
|
||||||
|
type: 'dropdown',
|
||||||
|
required: false,
|
||||||
|
description: '',
|
||||||
|
variables: true,
|
||||||
|
source: {
|
||||||
|
type: 'query',
|
||||||
|
name: 'getDynamicData',
|
||||||
|
arguments: [
|
||||||
|
{
|
||||||
|
name: 'key',
|
||||||
|
value: 'listServiceContracts',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Asset',
|
||||||
|
key: 'asset',
|
||||||
|
type: 'dropdown',
|
||||||
|
required: false,
|
||||||
|
description: '',
|
||||||
|
variables: true,
|
||||||
|
source: {
|
||||||
|
type: 'query',
|
||||||
|
name: 'getDynamicData',
|
||||||
|
arguments: [
|
||||||
|
{
|
||||||
|
name: 'key',
|
||||||
|
value: 'listAssets',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'SLA Name',
|
||||||
|
key: 'slaName',
|
||||||
|
type: 'dropdown',
|
||||||
|
required: false,
|
||||||
|
description: '',
|
||||||
|
variables: true,
|
||||||
|
source: {
|
||||||
|
type: 'query',
|
||||||
|
name: 'getDynamicData',
|
||||||
|
arguments: [
|
||||||
|
{
|
||||||
|
name: 'key',
|
||||||
|
value: 'listSlaNames',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Is Billable',
|
||||||
|
key: 'isBillable',
|
||||||
|
type: 'dropdown',
|
||||||
|
required: false,
|
||||||
|
description: '',
|
||||||
|
variables: true,
|
||||||
|
options: [
|
||||||
|
{ label: 'True', value: '1' },
|
||||||
|
{ label: 'False', value: '-1' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Service',
|
||||||
|
key: 'service',
|
||||||
|
type: 'dropdown',
|
||||||
|
required: false,
|
||||||
|
description: '',
|
||||||
|
variables: true,
|
||||||
|
source: {
|
||||||
|
type: 'query',
|
||||||
|
name: 'getDynamicData',
|
||||||
|
arguments: [
|
||||||
|
{
|
||||||
|
name: 'key',
|
||||||
|
value: 'listServices',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Rate',
|
||||||
|
key: 'rate',
|
||||||
|
type: 'string',
|
||||||
|
required: false,
|
||||||
|
description: '',
|
||||||
|
variables: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Service Type',
|
||||||
|
key: 'serviceType',
|
||||||
|
type: 'dropdown',
|
||||||
|
required: false,
|
||||||
|
description: '',
|
||||||
|
variables: true,
|
||||||
|
source: {
|
||||||
|
type: 'query',
|
||||||
|
name: 'getDynamicData',
|
||||||
|
arguments: [
|
||||||
|
{
|
||||||
|
name: 'key',
|
||||||
|
value: 'listCaseOptions',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'parameters.serviceType',
|
||||||
|
value: 'servicetype',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Service Location',
|
||||||
|
key: 'serviceLocation',
|
||||||
|
type: 'dropdown',
|
||||||
|
required: false,
|
||||||
|
description: '',
|
||||||
|
variables: true,
|
||||||
|
source: {
|
||||||
|
type: 'query',
|
||||||
|
name: 'getDynamicData',
|
||||||
|
arguments: [
|
||||||
|
{
|
||||||
|
name: 'key',
|
||||||
|
value: 'listCaseOptions',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'parameters.serviceLocation',
|
||||||
|
value: 'servicelocation',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Work Location',
|
||||||
|
key: 'workLocation',
|
||||||
|
type: 'string',
|
||||||
|
required: false,
|
||||||
|
description: '',
|
||||||
|
variables: true,
|
||||||
|
},
|
||||||
|
];
|
@@ -0,0 +1,78 @@
|
|||||||
|
import defineAction from '../../../../helpers/define-action.js';
|
||||||
|
import { fields } from './fields.js';
|
||||||
|
|
||||||
|
export default defineAction({
|
||||||
|
name: 'Create case',
|
||||||
|
key: 'createCase',
|
||||||
|
description: 'Create a new case.',
|
||||||
|
arguments: fields,
|
||||||
|
|
||||||
|
async run($) {
|
||||||
|
const {
|
||||||
|
summary,
|
||||||
|
recordCurrency,
|
||||||
|
caseTitle,
|
||||||
|
status,
|
||||||
|
priority,
|
||||||
|
contactName,
|
||||||
|
organizationName,
|
||||||
|
group,
|
||||||
|
assignedTo,
|
||||||
|
productName,
|
||||||
|
channel,
|
||||||
|
resolution,
|
||||||
|
category,
|
||||||
|
subCategory,
|
||||||
|
resolutionType,
|
||||||
|
deferredDate,
|
||||||
|
serviceContracts,
|
||||||
|
asset,
|
||||||
|
slaName,
|
||||||
|
isBillable,
|
||||||
|
service,
|
||||||
|
rate,
|
||||||
|
serviceType,
|
||||||
|
serviceLocation,
|
||||||
|
workLocation,
|
||||||
|
} = $.step.parameters;
|
||||||
|
|
||||||
|
const elementData = {
|
||||||
|
description: summary,
|
||||||
|
record_currency_id: recordCurrency,
|
||||||
|
title: caseTitle,
|
||||||
|
casestatus: status,
|
||||||
|
casepriority: priority,
|
||||||
|
contact_id: contactName,
|
||||||
|
parent_id: organizationName,
|
||||||
|
group_id: group,
|
||||||
|
assigned_user_id: assignedTo,
|
||||||
|
product_id: productName,
|
||||||
|
casechannel: channel,
|
||||||
|
resolution: resolution,
|
||||||
|
impact_type: category,
|
||||||
|
impact_area: subCategory,
|
||||||
|
resolution_type: resolutionType,
|
||||||
|
deferred_date: deferredDate,
|
||||||
|
servicecontract_id: serviceContracts,
|
||||||
|
asset_id: asset,
|
||||||
|
slaid: slaName,
|
||||||
|
is_billable: isBillable,
|
||||||
|
billing_service: service,
|
||||||
|
rate: rate,
|
||||||
|
servicetype: serviceType,
|
||||||
|
servicelocation: serviceLocation,
|
||||||
|
work_location: workLocation,
|
||||||
|
};
|
||||||
|
|
||||||
|
const body = {
|
||||||
|
operation: 'create',
|
||||||
|
sessionName: $.auth.data.sessionName,
|
||||||
|
element: JSON.stringify(elementData),
|
||||||
|
elementType: 'Cases',
|
||||||
|
};
|
||||||
|
|
||||||
|
const response = await $.http.post('/webservice.php', body);
|
||||||
|
|
||||||
|
$.setActionItem({ raw: response.data });
|
||||||
|
},
|
||||||
|
});
|
@@ -1,6 +1,13 @@
|
|||||||
|
import createCase from './create-case/index.js';
|
||||||
import createContact from './create-contact/index.js';
|
import createContact from './create-contact/index.js';
|
||||||
import createLead from './create-lead/index.js';
|
import createLead from './create-lead/index.js';
|
||||||
import createOpportunity from './create-opportunity/index.js';
|
import createOpportunity from './create-opportunity/index.js';
|
||||||
import createTodo from './create-todo/index.js';
|
import createTodo from './create-todo/index.js';
|
||||||
|
|
||||||
export default [createContact, createLead, createOpportunity, createTodo];
|
export default [
|
||||||
|
createCase,
|
||||||
|
createContact,
|
||||||
|
createLead,
|
||||||
|
createOpportunity,
|
||||||
|
createTodo,
|
||||||
|
];
|
||||||
|
@@ -1,27 +1,37 @@
|
|||||||
|
import listAssets from './list-assets/index.js';
|
||||||
import listCampaignSources from './list-campaign-sources/index.js';
|
import listCampaignSources from './list-campaign-sources/index.js';
|
||||||
|
import listCaseOptions from './list-case-options/index.js';
|
||||||
import listContactOptions from './list-contact-options/index.js';
|
import listContactOptions from './list-contact-options/index.js';
|
||||||
import listContacts from './list-contacts/index.js';
|
import listContacts from './list-contacts/index.js';
|
||||||
|
import listGroups from './list-groups/index.js';
|
||||||
import listLeadOptions from './list-lead-options/index.js';
|
import listLeadOptions from './list-lead-options/index.js';
|
||||||
import listMilestones from './list-milestones/index.js';
|
import listMilestones from './list-milestones/index.js';
|
||||||
import listOpportunityOptions from './list-opportunity-options/index.js';
|
import listOpportunityOptions from './list-opportunity-options/index.js';
|
||||||
import listOrganizations from './list-organizations/index.js';
|
import listOrganizations from './list-organizations/index.js';
|
||||||
|
import listProducts from './list-products/index.js';
|
||||||
import listProjects from './list-projects/index.js';
|
import listProjects from './list-projects/index.js';
|
||||||
import listRecordCurrencies from './list-record-currencies/index.js';
|
import listRecordCurrencies from './list-record-currencies/index.js';
|
||||||
|
import listServiceContracts from './list-service-contracts/index.js';
|
||||||
import listServices from './list-services/index.js';
|
import listServices from './list-services/index.js';
|
||||||
import listSlaNames from './list-sla-names/index.js';
|
import listSlaNames from './list-sla-names/index.js';
|
||||||
import listTasks from './list-tasks/index.js';
|
import listTasks from './list-tasks/index.js';
|
||||||
import listTodoOptions from './list-todo-options/index.js';
|
import listTodoOptions from './list-todo-options/index.js';
|
||||||
|
|
||||||
export default [
|
export default [
|
||||||
|
listAssets,
|
||||||
listCampaignSources,
|
listCampaignSources,
|
||||||
|
listCaseOptions,
|
||||||
listContactOptions,
|
listContactOptions,
|
||||||
listContacts,
|
listContacts,
|
||||||
|
listGroups,
|
||||||
listLeadOptions,
|
listLeadOptions,
|
||||||
listMilestones,
|
listMilestones,
|
||||||
listOpportunityOptions,
|
listOpportunityOptions,
|
||||||
listOrganizations,
|
listOrganizations,
|
||||||
|
listProducts,
|
||||||
listProjects,
|
listProjects,
|
||||||
listRecordCurrencies,
|
listRecordCurrencies,
|
||||||
|
listServiceContracts,
|
||||||
listServices,
|
listServices,
|
||||||
listSlaNames,
|
listSlaNames,
|
||||||
listTasks,
|
listTasks,
|
||||||
|
@@ -0,0 +1,29 @@
|
|||||||
|
export default {
|
||||||
|
name: 'List assets',
|
||||||
|
key: 'listAssets',
|
||||||
|
|
||||||
|
async run($) {
|
||||||
|
const assets = {
|
||||||
|
data: [],
|
||||||
|
};
|
||||||
|
|
||||||
|
const params = {
|
||||||
|
operation: 'query',
|
||||||
|
sessionName: $.auth.data.sessionName,
|
||||||
|
query: 'SELECT * FROM Assets ORDER BY createdtime DESC;',
|
||||||
|
};
|
||||||
|
|
||||||
|
const { data } = await $.http.get('/webservice.php', { params });
|
||||||
|
|
||||||
|
if (data.result?.length) {
|
||||||
|
for (const asset of data.result) {
|
||||||
|
assets.data.push({
|
||||||
|
value: asset.id,
|
||||||
|
name: `${asset.assetname} (${asset.assetstatus})`,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return assets;
|
||||||
|
},
|
||||||
|
};
|
@@ -0,0 +1,58 @@
|
|||||||
|
export default {
|
||||||
|
name: 'List case options',
|
||||||
|
key: 'listCaseOptions',
|
||||||
|
|
||||||
|
async run($) {
|
||||||
|
const caseOptions = {
|
||||||
|
data: [],
|
||||||
|
};
|
||||||
|
const {
|
||||||
|
status,
|
||||||
|
priority,
|
||||||
|
contactName,
|
||||||
|
productName,
|
||||||
|
channel,
|
||||||
|
category,
|
||||||
|
subCategory,
|
||||||
|
resolutionType,
|
||||||
|
serviceType,
|
||||||
|
serviceLocation,
|
||||||
|
} = $.step.parameters;
|
||||||
|
|
||||||
|
const picklistFields = [
|
||||||
|
status,
|
||||||
|
priority,
|
||||||
|
contactName,
|
||||||
|
productName,
|
||||||
|
channel,
|
||||||
|
category,
|
||||||
|
subCategory,
|
||||||
|
resolutionType,
|
||||||
|
serviceType,
|
||||||
|
serviceLocation,
|
||||||
|
];
|
||||||
|
|
||||||
|
const params = {
|
||||||
|
operation: 'describe',
|
||||||
|
sessionName: $.auth.data.sessionName,
|
||||||
|
elementType: 'Cases',
|
||||||
|
};
|
||||||
|
|
||||||
|
const { data } = await $.http.get(`/webservice.php`, { params });
|
||||||
|
|
||||||
|
if (data.result.fields?.length) {
|
||||||
|
for (const field of data.result.fields) {
|
||||||
|
if (picklistFields.includes(field.name)) {
|
||||||
|
field.type.picklistValues.map((item) =>
|
||||||
|
caseOptions.data.push({
|
||||||
|
value: item.value,
|
||||||
|
name: item.label,
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return caseOptions;
|
||||||
|
},
|
||||||
|
};
|
@@ -0,0 +1,29 @@
|
|||||||
|
export default {
|
||||||
|
name: 'List groups',
|
||||||
|
key: 'listGroups',
|
||||||
|
|
||||||
|
async run($) {
|
||||||
|
const groups = {
|
||||||
|
data: [],
|
||||||
|
};
|
||||||
|
|
||||||
|
const params = {
|
||||||
|
operation: 'query',
|
||||||
|
sessionName: $.auth.data.sessionName,
|
||||||
|
query: 'SELECT * FROM Groups;',
|
||||||
|
};
|
||||||
|
|
||||||
|
const { data } = await $.http.get('/webservice.php', { params });
|
||||||
|
|
||||||
|
if (data.result?.length) {
|
||||||
|
for (const group of data.result) {
|
||||||
|
groups.data.push({
|
||||||
|
value: group.id,
|
||||||
|
name: group.groupname,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return groups;
|
||||||
|
},
|
||||||
|
};
|
@@ -0,0 +1,29 @@
|
|||||||
|
export default {
|
||||||
|
name: 'List products',
|
||||||
|
key: 'listProducts',
|
||||||
|
|
||||||
|
async run($) {
|
||||||
|
const products = {
|
||||||
|
data: [],
|
||||||
|
};
|
||||||
|
|
||||||
|
const params = {
|
||||||
|
operation: 'query',
|
||||||
|
sessionName: $.auth.data.sessionName,
|
||||||
|
query: 'SELECT * FROM Products ORDER BY createdtime DESC;',
|
||||||
|
};
|
||||||
|
|
||||||
|
const { data } = await $.http.get('/webservice.php', { params });
|
||||||
|
|
||||||
|
if (data.result?.length) {
|
||||||
|
for (const product of data.result) {
|
||||||
|
products.data.push({
|
||||||
|
value: product.id,
|
||||||
|
name: product.productname,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return products;
|
||||||
|
},
|
||||||
|
};
|
@@ -0,0 +1,29 @@
|
|||||||
|
export default {
|
||||||
|
name: 'List service contracts',
|
||||||
|
key: 'listServiceContracts',
|
||||||
|
|
||||||
|
async run($) {
|
||||||
|
const serviceContracts = {
|
||||||
|
data: [],
|
||||||
|
};
|
||||||
|
|
||||||
|
const params = {
|
||||||
|
operation: 'query',
|
||||||
|
sessionName: $.auth.data.sessionName,
|
||||||
|
query: 'SELECT * FROM ServiceContracts ORDER BY createdtime DESC;',
|
||||||
|
};
|
||||||
|
|
||||||
|
const { data } = await $.http.get('/webservice.php', { params });
|
||||||
|
|
||||||
|
if (data.result?.length) {
|
||||||
|
for (const serviceContract of data.result) {
|
||||||
|
serviceContracts.data.push({
|
||||||
|
value: serviceContract.id,
|
||||||
|
name: serviceContract.subject,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return serviceContracts;
|
||||||
|
},
|
||||||
|
};
|
@@ -1,6 +1,8 @@
|
|||||||
---
|
---
|
||||||
favicon: /favicons/vtiger-crm.svg
|
favicon: /favicons/vtiger-crm.svg
|
||||||
items:
|
items:
|
||||||
|
- name: Create case
|
||||||
|
desc: Create a new case.
|
||||||
- name: Create contact
|
- name: Create contact
|
||||||
desc: Create a new contact.
|
desc: Create a new contact.
|
||||||
- name: Create opportunity
|
- name: Create opportunity
|
||||||
|
Reference in New Issue
Block a user