Microsoft Power Platform

Microsoft Power Platform

Exploring Triggers, Actions, and Functions in Microsoft Power Platform

In this blog post, I will explain what triggers, actions and functions are in Microsoft Power Platform and how you can use them to create powerful solutions for your business needs. I will also provide some examples of common scenarios where these concepts can be applied.

What are triggers?

Triggers are events that start a flow in Power Automate. A flow is a sequence of steps that perform tasks automatically based on certain conditions. For example, you can create a flow that sends an email notification when a new item is added to a SharePoint list or a flow that updates a record in Dataverse when a form is submitted.

There are different types of triggers that you can use depending on your scenario:

  • Instant triggers: These triggers allow you to run a flow manually with a tap of a button on your mobile device or from the Power Automate website. You can use instant triggers to perform tasks on demand, such as sending a reminder to your team or creating a task in Planner.

  • Scheduled triggers: These triggers allow you to run a flow on a specific date and time, or at regular intervals. You can use scheduled triggers to perform tasks periodically, such as sending a weekly report or backing up data.

  • Automated triggers: These triggers allow you to run a flow automatically when an external event occurs, such as when an email arrives, a tweet is posted, or a record is created or modified. You can use automated triggers to respond to changes in data or services that you use.

What are actions?

Actions are steps that perform tasks in a flow. Each action corresponds to an operation that you can do with a connector. A connector is a component that provides access to data and services from various sources, such as SharePoint, Outlook, Twitter, Dataverse, and more.

There are different types of actions that you can use depending on your scenario:

  • Standard actions: These actions allow you to perform common operations with connectors, such as reading, writing, updating, or deleting data. For example, you can use standard actions to get items from a SharePoint list, send an email with Outlook, post a tweet with Twitter, or create or update a record in Dataverse.

  • Premium actions: These actions allow you to perform advanced operations with connectors that require additional licensing or permissions. For example, you can use premium actions to call an HTTP endpoint, execute an SQL query, or run an Azure function.

  • Custom actions: These actions allow you to define your own reusable business logic in Dataverse and run it from Power Automate. For example, you can create a custom action that calculates the total amount of an invoice and returns it as an output parameter.

What are functions?

Functions are expressions that you can use to manipulate data or perform calculations in a flow. You can use functions to transform inputs and outputs of actions, add conditions and logic to your flow, or create dynamic content based on variables.

There are different types of functions that you can use depending on your scenario:

  • Built-in functions: These functions are predefined by Power Automate and cover various categories, such as string manipulation, date and time operations, mathematical calculations, logical comparisons, and more. For example, you can use built-in functions to concatenate two strings, format a date value, add two numbers, check if a condition is true or false, and so on.

  • Custom functions: These functions are defined by you using the Azure Functions service and can be called from Power Automate using the Azure Functions connector. You can use custom functions to extend the capabilities of Power Automate and integrate them with other services or platforms. For example, you can create a custom function that generates a QR code image from a text input and returns it as an output.

When to use triggers, actions and functions?

Triggers, actions and functions are the building blocks of any flow in Power Automate. You can combine them in various ways to create solutions for different scenarios. Here are some examples of how you can use them:

  • Send an email notification when a new item is added to a SharePoint list: You can use the SharePoint trigger When an item is created to start the flow when someone adds an item to the list. Then you can use the Outlook action Send an email (V2) to send an email notification with the details of the item. You can use functions to format the email body with dynamic content from the trigger output.

  • Update a record in Dataverse when a form is submitted: You can use the Microsoft Forms trigger When a new response is submitted to start the flow when someone fills out the form. Then you can use the Dataverse action Update a record to update an existing record with the values from the form. You can use functions to convert the form responses to the appropriate data types for the record fields.

  • Generate a QR code image from a text input: You can use the Power Apps trigger For a selected item to start the flow from a Power Apps app. Then you can use the Azure Functions action Call an Azure function to call a custom function that generates a QR code image from the text input. You can use functions to pass the text input as a parameter to the function and return the image as an output.

These are just some examples of what you can do with triggers, actions and functions in Power Automate. You can explore more possibilities by browsing the available connectors and templates, or by creating your own flows from scratch.

I hope this blog post has helped you understand the concepts of triggers, actions and functions in Microsoft Power Platform and how you can use them to create powerful solutions for your business needs. Thank you for reading!