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

QuickAction

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:
QuickAction.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.

QuickAction.QuickActionRequest req = new QuickAction.QuickActionRequest();
// Some quick action name
req.quickActionName = Schema.Account.QuickAction.AccountCreateContact; 

// Define a record for the quick action to create
Contact c = new Contact(); 
c.lastname = 'last name';
req.record = c; 

// Provide the context ID (or parent ID). In this case, it is an Account record.
req.contextid = '001xx000003DGcO'; 

QuickAction.QuickActionResult res = QuickAction.performQuickAction(req);

See Also

QuickActionRequest Constructors

The following are constructors for QuickActionRequest.

QuickActionRequest()

Creates a new instance of the QuickAction.QuickActionRequest class.

Signature

public QuickActionRequest()

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