Loading
Energy & Utilities Cloud
Add the Apex Actions to the Template Flows

Add the Apex Actions to the Template Flows

Integrate your new Apex classes into the emergency callout process by wiring them into the template flows as Apex actions. You need to assign these Apex classes to the dispatcher profile.

Required Editions

Available in: Lightning Experience
Available in: Enterprise, Performance, and Unlimited editions with Energy & Utilities - Growth, Field Service for Energy & Utilities, and Contractors for Energy & Utilities
User Permissions Needed
To add Apex actions to flows: Manage Flow
  1. Add the Apex actions to the Check Workforce Availability flow.
    1. From Setup, in the Quick Find box, enter Flows, and select Flows.
    2. Open the Check Workforce Availability flow.
    3. On the Yes path of the Have Service Appointment? decision, add an action element.
    4. Search and select Get Workforce Availability.
    5. Set callout ID to {!$Record.Id}.
    6. Set scheduling policy name to your scheduling policy, such as Emergency.
    7. Save and activate your flow.
  2. Add the Apex actions to the Generate Emergency Callout Roster flow.
    1. Open the Generate Emergency Callout Roster flow.
    2. Create a flow input variable for the requirement ID, and configure the Add Resource modal to pass the ID to this new variable.
    3. On the Yes path of the Have Callout Requirement Records? decision, add an action element before the Set Success Response element.
    4. Search and select Generate Emergency Callout Roster.
    5. Set callout ID to {!callOutId}.
    6. Set the callout requirement ID to your new requirement ID variable.
      Important
      Important The ranking action requires the requirement ID. Without this binding, the ranking fails and returns an empty list.
    7. Optionally, set a scheduling policy name or roster multiplier.
    8. Map the action's Success and Message outputs to the flow's existing isSuccess, successMessage, and errorMessage variables.
    9. Save and activate your flow.
  3. Add the Apex actions to the Rank Emergency Call Out Resources flow.
    1. Open the Call Out Rank Resources flow.
    2. Create a flow input variable for the requirement ID, and configure the Add Resource modal to pass the ID alongside the record ID.
    3. On the Yes path of the Is Service Appointment Assigned? decision, add an action element before the Set Ranking Outputs element.
    4. Search and select Rank Emergency Callout Candidates, and give the action element the API name RankResources.
    5. Set callout ID to {!recordId}.
    6. Set the callout requirement ID to your new requirement ID variable.
    7. Optionally, set scheduling policy name to {!schedulingPolicyName}, or leave it blank to use the default of Emergency.
    8. Edit the Set Ranking Outputs element, and rewrite its assignments to carry the action's real outputs instead of the placeholder literals.
    9. Change rankedResourcesJson from "[]" to {!RankResources.rankedResourcesJson}.
    10. Change isSuccess from true to {!RankResources.isSuccess}.
    11. Optionally, add errorMessage set to {!RankResources.message} so that the action's soft-fail messages reach the modal.
    12. Save and activate your flow.
Important
Important The ranking action requires the callout requirement ID to scope ranking to the selected pay grade. Without this binding, the ranking fails softly and returns an empty list. If you don't rewrite the Set Ranking Outputs assignments, the flow keeps returning the empty list and never calls the Apex, so no ranked candidates appear in the modal.
 
Loading
Salesforce Help | Article