Learn Automation Components - Trailhead - Salesforce

28 Jul.,2025

 

Learn Automation Components - Trailhead - Salesforce

Follow Along with Trail Together

Want to follow along with an expert as you work through this step? Take a look at this video, part of the Trail Together series.

You will get efficient and thoughtful service from Xingyu.

(This clip starts at the 2:33 minute mark, in case you want to rewind and watch the beginning of the step again.)

Introduction

Automation components help you extend the functionality of Flow Builder by using Apex classes and Lightning components. There are three types of components that can be used with flow: invocable actions, flow screen components, and flow local actions. Let’s learn more about these components by looking at their code.

Invocable Actions

Sometimes the automation logic that you need stretches beyond the declarative capability of Flow Builder. Invocable actions give developers an opportunity to write any complex logic in Apex and expose it in Flow Builder in the form of useful declarative building blocks. 

Let’s check out one of the invocable actions that has been installed into your org—the Clone Record List action. This invocable action is used to clone a list of records from inside a flow.

View the Clone Record List Action

We haven’t installed all of the Automation Components packages for this project, so let’s navigate back to GitHub to explore the code for flow screen components.

  1. Navigate to the Trailhead Sample Gallery.
  2. In the Browse Demos section, search automation. Click Explore on GitHub in the Automation Components app tile.
  3. Click src-collections | main/default/classes | CloneRecordList.cls to view the contents of the Apex class. (Click View Code if you can't see the contents of the Apex class.)
  4. Note the InputParameters and OutputParameters inner classes. Properties in each class are annotated with @InvocableVariableenabling you to use them to pass data into and out of the flow. 
    // Wrapper class for input parameters
      global class InputParameters {
           @InvocableVariable(required=true)
           global List collection;
      }
      //Wrapper class for output parameters
      global class OutputParameters {
           @InvocableVariable
           global List collection;
      }
  5. Note also the bulkInvoke Apex method. By annotating it with @InvocableMethod we can now invoke it as a flow action.
  6. Finally, notice the use of the InputParameters and OutputParameters classes in the execution of the bulkInvokemethod.
    @InvocableMethod(label='Clones a list of records' category='Collections')
      global static List bulkInvoke(List inputs) {
           List outputs = new List();
           for (InputParameters input : inputs) {
                OutputParameters output = new OutputParameters();
                output.collection = input.collection.clone();
                outputs.add(output);
           }
           return outputs;
      }
  7. Click on automation-components to return to the project root directory.

When accessing the invocable action from the Flow Builder, you will see that it has pulled through the label and description of the action as well as the input and output parameters that are defined in the Apex class.

Flow Screen Components

Flow Builder comes with a number of screen components that you can use to create rich screens and to capture user interactions. As a developer, you can create custom screen components to enhance the user experience inside a screen flow.

Screen components can be created with Lightning Web Components (LWC) or Aura components. In this project, we focus on Lightning Web Components.

  1. Click src-flows | main/default | lwc | flowPicker | flowPicker.js-meta.xml to open the contents of the Lightning web component.
  2. Here you can see the standard metadata structure of a Lightning web component's js-meta.xmlfile.
    • Take a look at the within the metadata. By adding lightning__FlowScreen as a target, the component is made visible to the Flow Builder.
    • Next are a number of properties that are being exposed to the flow inside the tags. You can see that each property specifies a name, type, role, label, default text, and a description. This makes them easier to identify when accessed in the Flow Builder.
      
        lightning__FlowScreen
      
      
        
             
        
      
  1. When you’re done, return to the project root directory.

Flow Local Actions

A flow local action is an Aura component that executes an action in the user’s browser while using a screen flow. Unlike screen flows, a local action Aura component exposes no UI and is only a service component that interacts with the UI. This can be used to complete actions that modify the user interface or to retrieve data from a third-party system without going through the Salesforce server.

  1. Click src-ui/main/default |aura | minimizeUtilityItem | minimizeUtilityItem.cmp to view the contents of the Aura component.
      
    
  2. Notice the standard Aura component that implements lightning:availableForFlowActions. This allows the component to be accessed inside the Flow Builder.
  3. Next, utilityBarApi is used to trigger a user interface modification with the Aura component.
  4. Note that there is no markup within the component, because flow local actions do not have a user interface.

When you’re done, click the Back button to return to the components directory.

Now let's look at the JavaScript behind the action.

  1. Click minimizeUtilityItemController.js.
    ({
      invoke: function (component) {
           var utilityAPI = component.find('utilityBar');
           // Minimize utility bar if it's open
           utilityAPI.getUtilityInfo()
           .then(function (response) {
                if (response.utilityVisible) {
                utilityAPI.minimizeUtility();
                }
           })
           .catch(function (error) {
                console.error(error);
           });
      }
    });
  2. Notice that the controller starts with the invoke function. The invoke is called when the local action is run in the flow.
  3. Next, the action runs through the code in the body of the function. In this example, we call utilityAPI.minimizeUtility(); to minimize the utility bar.

Now you’ve had a tour of the different types of automation components, you’re ready to dive into creating a flow that uses components from the sample app!

The Top 5 Basic Elements for Effective Building Automation

Building automation systems (BAS) are becoming increasingly prevalent in modern buildings as a way to improve energy efficiency, occupant comfort, and overall building operations. A well-designed building automation system can lead to significant cost savings by optimizing heating, ventilation, and air conditioning (HVAC), lighting, fire and life safety systems, and other building functions. However, effective building automation requires several key elements working together seamlessly. In this article, we'll explore the top 5 basic components that are essential for successful building automation implementation.

Sensors

Sensors are the eyes and ears of a building automation system. They collect data about various conditions within the building, such as temperature, humidity, occupancy, light levels, air quality, and more. Without accurate sensor data, the building automation system would be blind to the current state of the building, making it impossible to take appropriate actions. Common types of sensors used in building automation systems (BAS) include:

  • Temperature sensors
  • Current Sensors
  • Humidity sensors
  • Occupancy/motion sensors
  • Light level sensors
  • Air quality sensors (CO2, VOCs)
  • Water leak detection sensors
  • Fire/smoke detectors

Proper selection, placement, and calibration of sensors are crucial for optimal building automation performance.

Want more information on Valve Accessories? Feel free to contact us.

Systems Controls

At the heart of any building automation system lies the systems controls- the direct digital control (DDC) devices or controllers that make decisions and orchestrate building systems based on sensor inputs and programmed logic. These controls serve as the brain of the BAS, processing data from sensors, executing control algorithms, and issuing commands to output devices like actuators and relays.

DDC controllers can range from small, embedded devices controlling a single piece of equipment to larger, more powerful devices overseeing entire subsystems or the building management system (BMS) as a whole. Common examples include:

  • HVAC controls
  • Lighting controls
  • Fire and life safety system controls
  • Access control system controls
  • Controllers for individual equipment like air handling units, chillers, boilers, etc.

The capabilities and programming of these DDC controllers determine how effectively the various building systems operate and integrate with each other.

Output Control Devices

While sensors provide input data and controllers make decisions, output control devices are what physically actuate and control the building systems- opening/closing dampers and valves, modulating flow, switching equipment on and off, and so on. These devices translate the control decisions into tangible actions within the building. Common output devices in building automation include:

  • Actuators (damper, valve, etc.)
  • Relays/contactors
  • Variable frequency drives (VFDs)
  • Lighting ballasts/drivers

Building automation output devices are available in various models with different voltage ratings, control signal types (analog, digital, pulsed, etc.), and mounting configurations to interface with a wide range of equipment and systems.

Communication Languages / Protocols

For all the different components of a BAS to communicate and integrate effectively, they must speak the same language- or at least be able to interpret each other's languages. This is the role of communication protocols, which define the "vocabulary" and "grammar" that devices use to exchange data and commands. Widely used protocols in building automation include:

  • BACnet
  • LonWorks
  • Modbus
  • KNX
  • OPC

Effective building automation requires controllers, systems, sensors, and user interfaces that are compatible with the chosen protocol(s). Gateways and routers may be needed to facilitate communication between devices using different protocols.

User Interfaces

While much of a BAS operates autonomously based on programmed logic, user interfaces provide a means for human operators to monitor system performance, make manual adjustments, configure settings, and manage alarms or events. These interfaces put the power of the BAS directly into the hands of the facility staff. Common user interface components for building automation include:

  • PC workstations with graphical front-end software
  • Web-based dashboards and portals
  • Mobile apps
  • Handheld devices for portable access
  • Physical hardware interfaces like touchscreens and control panels

Intuitive graphical interfaces that provide unified control, data visualization, trending capabilities, and reporting tools are key for maintaining efficient and intelligent building operations.

Putting It All Together

Truly effective building automation requires the seamless integration of these five core elements- sensors, controls, output devices, communication protocols, and user interfaces. Information flows between them in a continuous cycle:

  1. Sensors detect conditions in the building
  2. That data is communicated to controllers
  3. Controllers make control decisions
  4. Those decisions are issued to output devices over the communication network
  5. Output devices directly control equipment and systems
  6. User interfaces allow monitoring and intervention
  7. And the cycle repeats with new sensor feedback

When properly designed and implemented, this interconnected system enables consistent occupant comfort, energy savings, equipment longevity, and optimized operations across the entire building. From small commercial buildings to expansive campuses, these five components lay the foundation for the successful implementation of building automation systems, direct digital controls (DDC), building management systems (BMS), and comprehensive integration of HVAC, lighting, fire/life safety, and other disciplines.

By understanding the essential roles that sensors, controls, output devices, protocols, and user interfaces play, building owners and operators can make informed decisions around building automation design, deployment, and ongoing operations. Investing in quality components and seamless integration lays the groundwork for a high-performance, energy-efficient building that delivers tangible benefits for years to come.

Functional Devices, Inc., located in the United States of America, has been designing and manufacturing quality electronic devices since . Our mission is to enhance lives in buildings and beyond. We do so by designing and manufacturing reliable, high-quality products for the building automation industry.  Our suite of product offerings include RIB relays, current sensors, power controls, power supplies, transformers, lighting controls, and more.

We test 100% of our products, which leads to less than 1 out of every 16,000 products experiencing a failure in the field.