Tutorial 8 - Create an insight card with two actions/buttons
A capability to create an insight card which can have up to two actions/buttons is introduced and is currently available in preview.
Added to Create card for assistant V3 (preview) operation.
Example: To create an insight card that will be displayed when an opportunity's estimated close date is within a day. We will add one action to extend close date by 10 days and another to open the opportunity.
Step 1: Create a trigger to start the flow
Set a trigger that runs every morning at 8 am.
In the search, enter Recurrence. From the search results, under the Triggers option, select Recurrence.
You'll see the below trigger. Enter Interval as 1 and select Frequency as Day. This ensures that the trigger will run once in day. The other columns can be set according to your requirement. In this example, we are setting At these hours as 8, as we want the trigger to run every morning at 8 AM.
Step 2: Get all opportunities which are closing today
Select New Step and in the search box, enter Microsoft Dataverse and choose List Records.
Add a filter query to retrieve all opportunities closing today.
estimatedclosedate eq @{formatDateTime(utcNow(), 'yyyy-MM-dd')}
Step 3: For every opportunity create a custom insight card
For all opportunities fetched from previous step, we will use new operation Create card for assistant V3 and create an insight card.
Click New Step below List records action and add Apply to each action.
In Apply to each operation, select Add an action and search for Sales Insights. Under actions, choose Create card for assistant V3 operation.
Step 4: Enter details and choose a primary action type
Enter the environment and other details as required.
Choose REST from the Primary action type dropdown.
Once you select REST, you will see the columns corresponding to that action. Now enter values for Primary action text, endpoint, http method and body as below. Refer to Tutorial 5 - Add a custom action button to insight card to invoke REST for more details about this action.
Endpoint:
https://TestOrg.crm10.dynamics.com/api/data/v9.0/opportunities(ID-FromPreviousStep)
HTTP Method: PATCH
Body:
{"estimatedclosedate": "@{getFutureTime(10, 'Day', 'yyyy-MM-dd')}"}
Step 5: Add a Secondary action type
Only perform this step if you have already added a Primary action to your operation.
Click Show advanced options.
Choose Open record from the Secondary action type dropdown.
Once you select Open record, you will see the columns corresponding to that action. Now enter values for Secondary action text, table type and record ID.
Step 6: Save the flow and test the flow
Run the flow manually or when it runs as scheduled, a new insight card should be available in the application.