Views:

 Overview

Microsoft Dataverse provides the ability to use generative AI to describe and build pages in Model Driven Apps. This article will show how to use a prompt to call a North52 Formula from inside this page. We are going to display a page that allows the user to select from a list of insurance policies and then run some validation logic against them. 

The full prompt used in this example is available here. If you would like just the part of the prompt specifically covering how to execute a North52 Formula, this is available here.

Model Driven App Designer

We open the Model Driven App and select Add Page → Describe a page.

 

This gives us the ability to enter our prompt.  

 

We enter our prompt and let the AI begin building the webpage.

 

When the page has been built, we can test it by selecting some of the records and clicking on the button.

 

North52 Formula

The Formula shown below is running on the Policy entity.

It is of type ClientSide - Perform Action. This type of formula allows us to return a result back to the webpage that can then be displayed back to the user if desired.

The Decision Table sheet works out what the Policy validation status is, and what messages to display.

 

The result sheet returns both the Validation status and the Message

In this instance we are using {VStatus} : {Message}

This is important to note as you will need to instruct your AI on how to process the result.

 

The Prompt

The full prompt used in our example is available here. This full prompt contains the description of what we are building, as well as the section explaining how to execute a North52 Formula.

The part of the prompt specifically covering how to execute a North52 Formula is available here.

Below is an important section to note, since our formula is returning  {VStatus} : {Message} we explain to the AI how to process the result. Make sure to tell your AI what it should do with formula result.

The Response UI Logic:

The returned string will be in the format Status: Message.
Split the string at the first colon (:) to separate the Status from the Message.

If the Status is 'Rejected', show the red alert banner using the Message part of the string.
If the Status is 'Valid', show the green success banner using the Message part (or a default success message).