Tutorial 8 - Create an insight card with two actions/buttons

Completed

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.

Dynamics 365 Sales Insights Actions tab shows Create card for assistant V3 (preview).

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.

  1. In the search, enter Recurrence. From the search results, under the Triggers option, select Recurrence.

    Search results for Recurrence shows Recurrence Schedule under Triggers.

  2. 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.

    Interval of 1 and Frequency of Day with At these hours set to 8 will run every morning at 8 AM.

Step 2: Get all opportunities which are closing today

  1. Select New Step and in the search box, enter Microsoft Dataverse and choose List Records.

    Under Microsoft Dataverse on the Actions tab, choose List records.

  2. Add a filter query to retrieve all opportunities closing today.

    estimatedclosedate eq @{formatDateTime(utcNow(), 'yyyy-MM-dd')}

    Shows the Filter Query set to estimatedclosedate eq formatDateTime.

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.

  1. Click New Step below List records action and add Apply to each action.

    Choose an action search results for "apply to each" on the Actions tab.

  2. In Apply to each operation, select Add an action and search for Sales Insights. Under actions, choose Create card for assistant V3 operation.

    Add an action and choose Create card for assistant V3.

Step 4: Enter details and choose a primary action type

  1. Enter the environment and other details as required.

  2. Choose REST from the Primary action type dropdown.

    Choose REST for the Primary action type.

  3. 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')}"}

    Create card for assistant V3 (Preview) with values entered for the Primary action.

Step 5: Add a Secondary action type

Only perform this step if you have already added a Primary action to your operation.

  1. Click Show advanced options.

  2. Choose Open record from the Secondary action type dropdown.

  3. 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.

    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.

The new insight card as it appears when it is run.