Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Microsoft Copilot Studio provides the orchestration of the AI capabilities for Copilot for finance and operations apps. Therefore, it enables a low-code maker experience for customizing the Copilot capabilities. This tutorial goes through an example that shows how to add new capabilities to Copilot by using Copilot Studio to add a plugin to the Copilot for Finance and Operation chatbot.
Scenario
In this scenario, you add the Copilot capability to translate a course description into another language when a prompt such as "Translate the course description into French" is entered in the Copilot panel. The steps provide guidance about how to create low-code plugins by using Copilot Studio and the AI translation capabilities of AI Builder.
Here's an overview of the steps in this tutorial:
- In Copilot Studio, create a new topic that gets triggered by a prompt to translate the course description.
- Add questions to the user to determine the course ID and language.
- Create an action that uses a Power Automate flow to get the course description.
- Create an action that uses AI Builder to translate the course description text.
- Create a message response to send the translated text back to the user in the Copilot pane.
- Test the new Copilot capability.
For a walkthrough of this tutorial, see Extend finance and operations apps Copilot capabilities with low-code plugins
Prerequisites
For this tutorial, you must first enable Copilot in finance and operations apps in your environment. For instructions, see Enable Copilot capabilities in finance and operations apps.
Step 1: Create a new topic
In this step, you create a new topic in the Copilot in Finance and Operation chatbot.
- Open Copilot Studio in the environment linked to your finance and operations apps.
- Open the Copilot for finance and operations apps Copilot chatbot.
- On the Topics & Plugins tab, in the Add dropdown list, select Topic > From blank.
- On the Trigger node, on the Phrases card, select Edit.
- In the Phrases pane, in the Enter text field, enter Translate the course description, and then select Enter.
Step 2: Determine the course ID and language
In the new topic, you use variables that are set with the user's page and record context to determine the course ID of the course, and add a question that Copilot asks the user to determine the language the description must be translated into. For more information on user context of finance and operations apps in copilot scenarios, see Use application context with Copilot.
Below the Trigger node, select the plus sign (+), and then select Add a condition.
On the Condition node, set the condition to verify the user is on the Courses page.
- Select the Select a variable field, and select the
Global.PA_Copilot_ServerForm_PageContext.metadataName
variable. - Set the condition for the variable to be is equal to the value HRMCourseTable.
- On the node, select New condition.
- Set the new condition to verify the
Global.PA_Copilot_ServerForm_PageContext.titleField1Value
variable is not Blank.
- Select the Select a variable field, and select the
Under the Condition node, create a new Set variable value node (Variable management > Set a variable value).
- For the Set variable value, create a new variable named CourseID.
- For the To value value, enter the
Global.PA_Copilot_ServerForm_PageContext.titleField1Value
variable.
On the other condition fork, under the All other conditions node, select the plus sign (+), and select Ask a question to create a Question node. Set the following values for the new node:
- Enter a message: Enter What is the course ID for the course description you want to translate?
- Identify: Specify User's entire response.
- Save response as: Select the variable, and change the Variable name value to
CourseID
.
Below the condition section, after the condition forks merge, select the plus sign (+), and then select Ask a question to create a second Question node. Set the following values for the new node:
- Enter a message: Enter Into what language do you want the description translated?
- Identify: Specify Language.
- Save response as: Select the variable, and change the Variable name value to LanguageChoice.
Step 3: Create an action to get the course description
In the topic, create an action that uses a flow to get the course description.
Select the plus sign (+), and then select Call an action > Create a flow. Power Automate is opened.
Select the When Power Virtual Agents calls a flow node to open the options, and define the following parameters:
- Select Text as the type of user input.
- In the Input field, enter CourseID.
In Power Automate, below the When Power Virtual Agents calls a flow node, select the plus sign (+), and then select Add an action.
In the Add an action pane, search for and select the List rows action in the Microsoft Dataverse connector.
On the Parameters tab for the List rows options, set the following values:
Table Name: Courses V2 (mserp)
Note
If the Courses V2 (mserp) table isn't available in your environment, you must enable it. For instructions, see Enable Microsoft Dataverse virtual entities.
Select Columns: mserp_coursedescription
Filter Rows: mserp_courseid eq '
CourseID
'Note
To select the
CourseID
variable, select the Parameters button (lightning bolt symbol). You can then select data from a previous step.
Add an action to compose the course record.
- Below the List rows action, select the plus sign (+), and then select Add an action.
- In the Add an action pane, search for and select the Compose data operation.
- Use the Parameters action on the Inputs field to select the value parameter from the List rows action as the input value.
Add an action to parse the JavaScript Object Notation (JSON) for the course record.
Below the Compose action, select the plus sign (+), and then select Add an action.
In the Add an action pane, search for and select the Parse JSON data operation.
In the Content parameter of the Parameters pane, select the Outputs parameter from the Compose action.
In the Schema parameter, enter the following JSON schema.
{ "type": "array", "items": { "type": "object", "properties": { "@@odata.type": { "type": "string" }, "@@odata.id": { "type": "string" }, "@@odata.editLink": { "type": "string" }, "mserp_coursedescription": { "type": "string" }, "mserp_hcmcoursev2entityid@odata.type": { "type": "string" }, "mserp_hcmcoursev2entityid": { "type": "string" } }, "required": [ "@@odata.type", "@@odata.id", "@@odata.editLink", "mserp_coursedescription", "mserp_hcmcoursev2entityid@odata.type", "mserp_hcmcoursev2entityid" ] } }
Initialize a variable for the course description that will be the output of the flow.
- Below the Parse JSON action, select the plus sign (+), and then select Add an action.
- Search for and select the Initialize variable action in the Variable group of actions.
- In the Name parameter, enter CourseDescription.
- In the Type parameter, specify String.
Set the variable to the course description.
- Below the Initialize variable action, select the plus sign (+), and then select Add an action.
- Search for and select the Set variable action in the Variable group of actions.
- In the Name parameter, enter CourseDescription.
- In the Value parameter, select the
Body mserp_coursedescription
parameter from the Parse JSON action.
Select the flow output to send back to Copilot Studio.
- Select the Return value(s) to Power Virtual Agents node.
- On the Parameters tab, select Add an output, and select Text as the type of output.
- Enter CourseDescription as the parameter name.
- In the Enter a value to respond with parameter, select the CourseDescription variable from the Variables parameters.
Select the flow name, and rename the flow Get course description demo.
Save the flow.
Back in Copilot Studio, in the Save and refresh dialog box, select Done.
Below the Question node for the language selection, select the plus sign (+), and then select Call an action.
In the Select an action dialog box, select the Get course description demo action that you created in the flow.
On the Course description demo action node, select the
Topic.CourseID
variable for the CourseID (String) input.
Step 4: Create an action that translates the course description
In the topic, create an action that uses AI Builder to translate the course description that was retrieved in the previous step.
Below the Get course description demo action node, select the plus sign (+), and then select Call an action > Create a prompt.
In the Prompt by AI Builder window, enter "TranslateText" for the prompt name.
In the Prompt settings pane, open the Input FastTab and select Add input
Set the following values for the new input:
- Name: Course Description
- Sample data: This course introduces you to the health and safety role at Contoso.
Select Add input again.
- Name: Language
- Sample data: Italian
In the Prompt field, enter "Translate
Course Description
into languageLanguage
", using the Insert action to select the variables in the prompt.Select Test prompt to test the prompt action.
Select Save custom prompt and close the Prompt Builder window.
Back in Copilot Studio, in the Save and refresh dialog box, select Done.
Below the Course description demo action node, select the plus sign (+), and then select Call an action > TranslateText.
- On the TranslateText action node, select the
Topic.CourseDescription
variable for the Course Description (String) input. - Select the
Topic.LanguageCode
variable for the Language (String) input. - For the predictionOutput output, create a new
TextTranslation
variable.
- On the TranslateText action node, select the
Step 5: Create a message to return the translated text to Copilot
In the chatbot, add a message node that returns the translated course description output to Copilot in finance and operations apps.
- Below the TranslateText action node, select the plus sign (+), and then select Send a message.
- In the Enter a message field, select the Insert variable action, and select the
Topic.TranslatedText
variable.
Step 6: Test the new capability in Copilot
- In Copilot Studio, select Save to save the new topic.
- On the Publish tab, select Publish to publish your changes to the chatbot.
- In finance and operations apps, open the Courses page (Human Resources > Courses), and select a course to open the details.
- On the navigation bar, select the Copilot button to open the Copilot pane.
- In the chat panel, enter Translate the course description into Japanese, and follow the prompt to get a response.