Overview
Using AI to generate a summary of your business rules eases the burden of manually writing documentation. This article shows you how to create a simple Power Automate Flow, with a connection to the AI language model of your choice, that will generate comprehensive summaries of your business rules.
The output is stored in the Formula Summary field which can then be used for automated documentation production (e.g. export to Excel, etc).
We are using OpenRouter as the service for our AI as it provides access to many models—at the time of writing we have found Claude Sonnet to produce very good results. You can experiment with different models to see which works best for you.
Power Automate Flow
We want to be able to run this Flow on one or more records, so will create and Instant Cloud Flow.
Create the Flow
- Go to https://make.powerautomate.com/
- Select Create
- Select Instant Cloud Flow
- For the Flow name, enter: Generate AI Summary for Business Rules
- Select When a row is selected (Microsoft Dataverse)
- Click the Create button
When a row is selected action
- Select N52 Formula for the Table Name
Add a new Initialize variable action
- Enter Prompt for the Name
- Select String as the Type
- In value enter: 'You are a technical writer specializing in business rules. Write a plain text summary that describes the following rules:
' + - Place the cursor after the +, then select Formula Description from the Dynamic Content options
Add a new HTTP action
Documentation for OpenRouter api: https://openrouter.ai/docs/api-reference/completion
- Select POST as the Method
- URI: https://openrouter.ai/api/v1/completions
- Headers:
- Content-Type / application/json
- Authorization / Bearer [your key here from environment variable]
- Body:
- {
"model": "anthropic/claude-3.7-sonnet",
"prompt": "@{variables('Prompt')}"
}
- {
Add a new Update a row action
- Select N52 Formula for the Table name
- Select Formula (unique ID) from the Dynamic Content for the Row ID
- Expand Show all and in the Formula Summary field add the following expression:
- body('HTTP')?['choices']?[0]?['text']
- Click Save
Testing
Open the North52 App and select Formulas from the left navigation. Select one or more Formulas, from the Flow menu select Generate AI Summary for Formula, then Run Flow.
The flow will run asynchronously, and when completed your selected Formulas will have been updated with an AI generated summary:
Prompt Variations
You may wish to experiment with the prompt to generate different summaries. For example for a short summary edit the prompt to say something like:
…Write a plain text one paragraph summary that describes the following rules