Newer Version Available

This content describes an older version of this product. View Latest

Macro

Represents a macro, which is a set of instructions that tells the system to perform one or more tasks. This object is available in API version 32.0 and later.

Supported Calls

create(), delete(), describeSObjects(), getDeleted()getUpdated(), query(), retrieve(), search(), update()

Fields

Field Details
Description
Type
textarea
Properties
Create, Nillable, Update
Description
Description of what this macro does.
LastReferencedDate
Type
dateTime
Properties
Filter, Nillable, Sort
Description
The date and time that the macro record was last referenced.
LastViewedDate
Type
dateTime
Properties
Filter, Nillable, Sort
Description
The date and time that the macro record was last viewed.
Name
Type
string
Properties
Create, Filter, Group, Sort, Update
Description

Name of the macro.

OwnerId
Type
reference
Properties
Create, Filter, Group, Sort, Update
Description

ID of the owner of the session record.

Usage

A macro definition consists of a Macro object and several associated MacroInstruction objects.

First, create a Macro object. Then, create MacroInstruction objects.

A macro contains an ordered list of macro instructions whose index field, sortOrder, is 0-based. If there's an incorrect sequence of macro instructions, the macro will not execute.

If you update a macro definition or add or remove instructions from a macro, delete the existing macro instructions and re-create instructions. Make sure that the sortOrder field that defines the execution order is correct. To delete an entire macro definition, invoke the delete operation on the Macro object.

The table describes the supported macro instruction targets and how they relate to each other.

Strings indicated by <brackets> are variables. The variable description describes the required type. For example, Tab.<EntityApiName requires the entity name. If your custom entity name is MyCustomObject, your target API is Tab.MyCustomObject__c.

Note

If a macro instruction listed in the table supports an implicit operation, you can use that operation as a direct child instruction without explicitly specifying a target. The hyphens used in the table illustrate the hierarchical relationship between targets. A target isn't available if its parent isn’t.

Table 1. Macro Instruction Target Grammar and Hierarchy
Target API Name Supported Operations
Tab.<EntityApiName> SELECT, CLOSE (implicit)
- QuickAction.<EntityApiName>.<QuickActionName> SELECT, SUBMIT (implicit)
- - Field.<QATargetEntityApiName>.<FieldApiName> SET
- - Field.<QATargetEntityApiName>.<MultilineTextFieldApiName>.cursor INSERT
- - Field.<QATargetEntityApiName>.<SinglelineTextFieldApiName>.end INSERT
- QuickAction.Case.Email SELECT, SUBMIT (implicit)
- - Field.EmailMessage.<FieldApiName> SET
- - Field.EmailMessage.<MultilineTextFieldApiName>.cursor INSERT
- - Field.EmailMessage.<SinglelineTextFieldApiName>.end INSERT
- - Field.EmailTemplate SET
- SidebarCmp.Knowledge SELECT
- - SearchAction.KnowledgeArticle SELECT
- - - Field.SearchString SET, INSERT
- - - Command.Search SUBMIT
- - SearchResult.KnowledgeArticle.MostRecentItem SELECT
- - - Command.AttachToRecord SUBMIT
- - - Command.InsertToEmail SUBMIT
- - - Command.AttachToEmailAsPDF SUBMIT

Example

This example describes a macro that opens a quick action, sets some fields in the quick action, and submits the quick action.

10. SELECT Tab.Case
21.   SELECT QuickAction.Case.Email
32.     SET Field.EmailMessage.Subject
43.     SET Field.EmailMessage.ToAddress
54.     INSERT Field.EmailMessage.HtmlBody.cursor
65.     SUBMIT