QuickAction Class
Use Apex to request and process actions on objects that allow custom fields, on objects that appear in a Chatter feed, or on objects that are available globally.
In this sample, the trigger determines if the new contacts to be inserted are created by a quick action. If so, it sets the WhereFrom__c custom field to a value that depends on whether the quick action is global or an Account action. Otherwise, if the inserted contacts don’t originate from a quick action, the WhereFrom__c field is set to 'NoAction'.
This sample performs a global action—QuickAction.CreateContact–on the passed-in contact object.
See Also
The following are methods for QuickAction. All methods are static.
-
describeAvailableQuickActions(parentType)
Returns metadata information for the available quick actions of the provided parent object.
-
describeQuickActions(sObjectNames)
Returns the metadata information for the provided quick actions.
-
performQuickAction(quickActionRequest)
Performs the quick action specified in the quick action request and returns the action result.
-
performQuickAction(quickActionRequest, allOrNothing)
Performs the quick action specified in the quick action request with the option for partial success, and returns the result.
-
performQuickActions(quickActionRequests)
Performs the quick actions specified in the quick action request list and returns action results.
-
performQuickActions(quickActionRequests, allOrNothing)
Performs the quick actions specified in the quick action request list with the option for partial success, and returns action results.
Returns metadata information for the available quick actions of the provided parent object.
public static List<QuickAction.DescribeAvailableQuickActionResult> describeAvailableQuickActions(String parentType)
- parentType: Type: String The parent object type. This can be an object type name (‘Account’) or ‘Global’ (meaning that this method is called at a global level and not an entity level).
Type: List<QuickAction.DescribeAvailableQuickActionResult>
The metadata information for the available quick actions of the parent object.
Returns the metadata information for the provided quick actions.
public static List<QuickAction.DescribeQuickActionResult> describeQuickActions(List<String> sObjectNames)
- sObjectNames: Type: List<String> The names of the quick actions. The quick action name can contain the entity name if it is at the entity level (‘Account.QuickCreateContact’), or ‘Global’ if used for the action at the global level (‘Global.CreateNewContact’).
Type: List<QuickAction.DescribeQuickActionResult>
The metadata information for the provided quick actions.
Performs the quick action specified in the quick action request and returns the action result.
public static QuickAction.QuickActionResult performQuickAction(QuickAction.QuickActionRequest quickActionRequest)
- quickActionRequest: Type: QuickAction.QuickActionRequest
Type: QuickAction.QuickActionResult
Performs the quick action specified in the quick action request with the option for partial success, and returns the result.
public static QuickAction.QuickActionResult performQuickAction(QuickAction.QuickActionRequest quickActionRequest, Boolean allOrNothing)
- quickActionRequest: Type: QuickAction.QuickActionRequest
- allOrNothing: Type: Boolean Specifies whether this operation allows partial success. If you specify
falsefor this argument and a record fails, the remainder of the DML operation can still succeed. This method returns a result object that can be used to verify which records succeeded, which failed, and why.
Type: QuickAction.QuickActionResult
Performs the quick actions specified in the quick action request list and returns action results.
public static List<QuickAction.QuickActionResult> performQuickActions(List<QuickAction.QuickActionRequest> quickActionRequests)
- quickActionRequests: Type: List<QuickAction.QuickActionRequest>
Type: List<QuickAction.QuickActionResult>
Performs the quick actions specified in the quick action request list with the option for partial success, and returns action results.
public static List<QuickAction.QuickActionResult> performQuickActions(List<QuickAction.QuickActionRequest> quickActionRequests, Boolean allOrNothing)
- quickActionRequests: Type: List<QuickAction.QuickActionRequest>
- allOrNothing: Type: Boolean Specifies whether this operation allows partial success. If you specify
falsefor this argument and a record fails, the remainder of the DML operation can still succeed. This method returns a result object that can be used to verify which records succeeded, which failed, and why.