-
Notifications
You must be signed in to change notification settings - Fork 1
WorkCardComponentController
Ethan Dunzer edited this page Aug 29, 2024
·
1 revision
The WorkCardComponentController class is responsible for handling pagination and sorting functionality for the WorkCardComponent in a Salesforce application. This class allows for retrieving a specific subset of work item actions based on the page number and size, and sorting them by their status.
This method retrieves a paginated list of work item actions, sorted by status, for a specific work record and the current user.
Signature:
@AuraEnabled(cacheable=true)public static Map<String, Object> getPaginatedWorkItemActions(Id workId, Integer pageSize, Integer pageNumber)
Parameters:
-
workId: The ID of the work record for which to fetch associated work item actions. -
pageSize: The number of records to return per page. -
pageNumber: The page number to retrieve.
Returns:
- A map containing a list of Work_Item_Action__c records for the current page and the total number of records.
Details:
- Captures the current user's ID.
- Constructs a SOQL query to fetch work item actions that are associated with the provided work record ID and the current user.
- Applies sorting by status, prioritizing "Not Started" actions.
- Applies pagination based on the provided page size and number.
- Returns a map with the paginated list of actions and the total record count.
Example Usage: This method can be used to fetch and display a specific subset of work item actions, allowing users to navigate through multiple pages of tasks or actions.