@pliancy/salesforce-cpq-sdk 2.0.0 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -100,6 +100,17 @@ export type QuoteWithLineItems = Quote & {
|
|
|
100
100
|
};
|
|
101
101
|
export type UpdateQuoteLine = Pick<QuoteLine, 'Id' | 'SBQQ__Quantity__c'>;
|
|
102
102
|
export type UpdateQuoteLinesRequest = UpdateQuoteLine[];
|
|
103
|
-
export
|
|
103
|
+
export declare enum ApprovalStatus {
|
|
104
|
+
APPROVED = "Approved",
|
|
105
|
+
REJECTED = "Rejected",
|
|
106
|
+
PENDING = "Pending",
|
|
107
|
+
REQUIRED = "Required : Not Sent for Approval",
|
|
108
|
+
NOT_REQUIRED = "Approval Not Required"
|
|
109
|
+
}
|
|
104
110
|
export type QuoteQuery = QueryCondition<Schema, 'SBQQ__Quote__c'>;
|
|
105
111
|
export type UpdateQuoteQuery = SObjectUpdateRecord<Schema, 'SBQQ__Quote__c'>;
|
|
112
|
+
export interface ApprovalProcessRequest {
|
|
113
|
+
success: boolean;
|
|
114
|
+
errors?: string[];
|
|
115
|
+
newWorkItemIds?: string[];
|
|
116
|
+
}
|
|
@@ -1,2 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ApprovalStatus = void 0;
|
|
4
|
+
var ApprovalStatus;
|
|
5
|
+
(function (ApprovalStatus) {
|
|
6
|
+
ApprovalStatus["APPROVED"] = "Approved";
|
|
7
|
+
ApprovalStatus["REJECTED"] = "Rejected";
|
|
8
|
+
ApprovalStatus["PENDING"] = "Pending";
|
|
9
|
+
ApprovalStatus["REQUIRED"] = "Required : Not Sent for Approval";
|
|
10
|
+
ApprovalStatus["NOT_REQUIRED"] = "Approval Not Required";
|
|
11
|
+
})(ApprovalStatus || (exports.ApprovalStatus = ApprovalStatus = {}));
|
|
@@ -14,12 +14,12 @@ export declare class Quotes {
|
|
|
14
14
|
order(quoteId: string, options?: UpdateQuoteQuery): Promise<SaveResult>;
|
|
15
15
|
submitAndApprove(quoteId: string, comments?: string): Promise<{
|
|
16
16
|
success: boolean;
|
|
17
|
-
workItemId:
|
|
17
|
+
workItemId: string;
|
|
18
18
|
errors?: undefined;
|
|
19
19
|
error?: undefined;
|
|
20
20
|
} | {
|
|
21
21
|
success: boolean;
|
|
22
|
-
errors:
|
|
22
|
+
errors: string[] | undefined;
|
|
23
23
|
workItemId?: undefined;
|
|
24
24
|
error?: undefined;
|
|
25
25
|
} | {
|
|
@@ -70,18 +70,18 @@ class Quotes {
|
|
|
70
70
|
try {
|
|
71
71
|
const { ApprovalProcess } = require('jsforce/lib/process');
|
|
72
72
|
const approvalProcess = new ApprovalProcess(this.connection);
|
|
73
|
-
const
|
|
73
|
+
const sResult = (await approvalProcess.submit(quoteId, comments, {
|
|
74
74
|
skipEntryCriteria: true,
|
|
75
75
|
}));
|
|
76
|
-
if (
|
|
77
|
-
const workItemId =
|
|
76
|
+
if ((sResult === null || sResult === void 0 ? void 0 : sResult.newWorkItemIds) && (sResult === null || sResult === void 0 ? void 0 : sResult.newWorkItemIds.length)) {
|
|
77
|
+
const workItemId = sResult.newWorkItemIds[0];
|
|
78
78
|
if (!workItemId)
|
|
79
79
|
return { success: false, errors: ['No workItemId returned'] };
|
|
80
80
|
await approvalProcess.approve(workItemId);
|
|
81
81
|
return { success: true, workItemId };
|
|
82
82
|
}
|
|
83
83
|
else {
|
|
84
|
-
return { success: false, errors:
|
|
84
|
+
return { success: false, errors: sResult.errors };
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
87
|
catch (error) {
|