Shantha Kumar T
5 Useful formulas to use within Copilot Studio
Unlock the full potential of your Copilot Studio agents with powerful formulas and smart action design. This blog dives into practical examples to make your agent more dynamic and efficient.
When we build an agent using Copilot Studio, it’s not only using the generative AI features. That includes how we create a Topics and actions used for building the agent. Actions are used to compose multiple formulas across the Topics to make interactions dynamic and efficient. Here are some useful formulas you can use directly: in Copilot Studio.
1. Extract Specific Data from JSON Responses
json function which parses the string and helps to find the property inside the json object.
The following example helps to fetch the orderStatus value dynamically from the API response.
json(Topic.API_Response)?.data?.orderStatus
Example: Retrieves the orderStatus value from the JSON object
2. Format Dates for User-Friendly Responses
Text function can be used to convert the date format to friendly readable format. Data type also converted to text.
Convert system timestamps into a readable date inside a Topic:
Text(Now(), "MMMM dd, yyyy")
3. Use Conditional Logic for Dynamic Responses
Make your bot smarter by responding based on user input:
If("refund" in System.Activity.Text), "Processing refund...", "How can I assist?")
Example: If the user entered query contains refund, prints the message “Processing refund…” otherwise it will prints the else message.
4. Perform Calculations with Topic Variables
Mathematical test calculations are possible inside the copilot studio by using the in-built functions.
Sum(Topic.currentTotal, (Topic.itemPrice * Topic.quantity))
Example: Calculates the product of itemPrice and quantity, then adds to currentTotal.
5. Validate the entered input is Number
Before you calculate the values, the following function helps to identify whether it is a number or not.
isNumeric(Topic.userInput)
Example: If the value is number, returns Yes otherwise returns No
Combining these formulas inside Topics and Custom Actions helps to build smarter Apps with dynamic responses and data processing easier!