UNPKG

1.93 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>(contextId: string, record: Record<T>, callback?: Callback<QuickActionResult>): Promise<QuickActionResult>;
25}
26
27// TODO: figure out the actual shape of this. the docs don't have it
28export type QuickActionResult = object;
29
30export interface QuickActionInfo {
31 /** Type of the action (e.g. Create, Update, Post, LogACall) */
32 type: string;
33 /** Name of the action */
34 name: string;
35 /** Label of the action */
36 label: string;
37 /** Endpoint URL information of the action */
38 urls: object;
39}
40
41export interface QuickActionDescribeInfo {
42 /** Object type used for the action */
43 contextSobjectType: string;
44 /** Object type of the action to target */
45 targetSobjectType: string;
46 /** Field name in the target object which refers parent(context) object record ID */
47 targetParentField: string;
48 /** Record type of the targeted record */
49 targetRecordTypeId: string;
50 /** Layout sections that comprise an action */
51 layout: object;
52}