Newer Version Available
QuickActionRequest Class
Use the QuickAction.QuickActionRequest class for providing action information for quick
actions to be performed by QuickAction class methods.
Action information includes the action name, context record ID, and record.
Namespace
Usage
For Apex saved using Salesforce API version 28.0, a parent ID is associated with the QuickActionRequest instead of the context ID.
The constructor of this class takes no arguments:
1QuickAction.QuickActionRequest qar = new QuickAction.QuickActionRequest();Example
In this sample, a new quick action is created to create a contact and assign a record to it.
1QuickAction.QuickActionRequest req = new QuickAction.QuickActionRequest();
2// Some quick action name
3req.quickActionName = Schema.Account.QuickAction.AccountCreateContact;
4
5// Define a record for the quick action to create
6Contact c = new Contact();
7c.lastname = 'last name';
8req.record = c;
9
10// Provide the context ID (or parent ID). In this case, it is an Account record.
11req.contextid = '001xx000003DGcO';
12
13QuickAction.QuickActionResult res = QuickAction.performQuickAction(req);QuickActionRequest Methods
The following are methods for QuickActionRequest. All are instance methods.
getContextId()
Returns this QuickAction’s context record ID.
Signature
public Id getContextId()
Return Value
Type: ID
getQuickActionName()
Returns this QuickAction’s name.
Signature
public String getQuickActionName()
Return Value
Type: String
getRecord()
Returns the QuickAction’s associated record.
Signature
public SObject getRecord()
Return Value
Type: sObject
setContextId(contextId)
Sets this QuickAction’s context ID. Returned by getContextId.
Signature
public Void setContextId(Id contextId)
Parameters
- contextId
- Type: ID
Return Value
Type: Void
Usage
For Apex saved using Salesforce API version 28.0, sets this QuickAction’s parent ID and is returned by getParentId.
setQuickActionName(name)
Sets this QuickAction’s name. Returned by getQuickActionName.
Signature
public Void setQuickActionName(String name)
Parameters
- name
- Type: String
Return Value
Type: Void
setRecord(record)
Sets a record for this QuickAction. Returned by getRecord.
Signature
public Void setRecord(SObject record)
Parameters
- record
- Type: sObject
Return Value
Type: Void