UNPKG

1.96 kBTypeScriptView Raw
1import { Callback } from "./connection";
2import { Record } from "./record";
3
4export class QuickAction {
5 /**
6 * Retrieve default field values in the action for the given record
7 * @param contextId Id of record
8 * @param callback Callback function
9 */
10 defaultValues(contextId: string, callback?: Callback<Record>): Promise<Record>;
11 /** Retrieve default field values in the action */
12 defaultValues(callback?: Callback<Record>): Promise<Record>;
13 /**
14 * Describe the action's information (including layout, etc.)
15 * @param callback Callback function
16 */
17 describe(callback?: Callback<QuickActionDescribeInfo>): Promise<QuickActionDescribeInfo>;
18 /**
19 * Execute the action for given context id and record information
20 * @param contextId Context record ID of the action
21 * @param record Input record information for the action
22 * @param callback Callback function
23 */
24 execute<T>(
25 contextId: string,
26 record: Record<T>,
27 callback?: Callback<QuickActionResult>,
28 ): Promise<QuickActionResult>;
29}
30
31// TODO: figure out the actual shape of this. the docs don't have it
32export type QuickActionResult = object;
33
34export interface QuickActionInfo {
35 /** Type of the action (e.g. Create, Update, Post, LogACall) */
36 type: string;
37 /** Name of the action */
38 name: string;
39 /** Label of the action */
40 label: string;
41 /** Endpoint URL information of the action */
42 urls: object;
43}
44
45export interface QuickActionDescribeInfo {
46 /** Object type used for the action */
47 contextSobjectType: string;
48 /** Object type of the action to target */
49 targetSobjectType: string;
50 /** Field name in the target object which refers parent(context) object record ID */
51 targetParentField: string;
52 /** Record type of the targeted record */
53 targetRecordTypeId: string;
54 /** Layout sections that comprise an action */
55 layout: object;
56}