For Apex saved using Salesforce API version 28.0, a parent ID is associated with the QuickActionRequest instead of the context ID.
QuickAction.QuickActionRequest qar = new QuickAction.QuickActionRequest();
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);
The following are methods for QuickActionRequest. All are instance methods.
public Id getContextId()
Type: ID
public String getQuickActionName()
Type: String
public SObject getRecord()
Type: sObject
public Void setContextId(Id contextId)
Type: Void
For Apex saved using Salesforce API version 28.0, sets this QuickAction’s parent ID and is returned by getParentId.
public Void setQuickActionName(String name)
Type: Void
public Void setRecord(SObject record)
Type: Void