Tutorial 6 - Adding a custom action button to insight card to invoke custom action (CRM Process)
A capability to add custom-defined actions to insight cards is introduced and is currently available in preview.
New button types are introduced to Create card for assistant V2 operation.
Examples use case
We will create an insight card that will be displayed when an opportunity estimated closing date is within a day and we will add an action to extend estimated closing date by 10 days.
Test Data
Create one or more opportunities where the estimated closing date is current date.
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 the custom insight card.
For all opportunities fetched from previous step, we will use new operation Create card for assistant V2 and create an insight card.
Click New Step below List records action and add Apply to each action.
Select all opportunities from Dynamic content for iteration.
In Apply to each operation, select Add an action and search for Sales Insight. You will see sales insight action as shown in introduction section, choose Create card for assistant V2 operation.
Enter the environment.
You can observe that Extend Close Date is used as button text.
We will make Extend Close Date to extend the estimated close date of related opportunity using REST and custom action.
3.1 Action using Custom Action
We will now invoke a custom action in CRM, which will change estimated closing date.
3.1.1 Create a custom action inside CRM to extend estimated close date
To create a custom action, go to Settings > Processes > New.
Enter the name as ExtendClosingDate, and select Category as Action and table as Opportunity.
From Add Step, select Update Record.
Select Set Properties and then configure Est. Close Date as 10 days after current Est. Close Date.
Select Save and Close and then activate the custom action to be discovered by our operation.
3.1.2 Invoking custom action from an insight card with opportunity as target
In Apply to each action, select Add an action.
Search for Sales insight and select Choose custom action (CRM process) for an insight card.
Select the environment, and then select Filter by table as Opportunities and Custom action (CRM process) as ExtendedClosingDate.
Enter the opportunity ID in the Target box. Use the opportunity ID that is used in the previous step from Dynamic content.
After the selection you'll see the operation as below.
Add Create card for assistant V2 step below as we did for REST.
Select Button type as Custom action (CRM Process). You'll see a new column Custom action for insight card column.
Select Custom action for insight card from dynamic content popup. This is a custom action we chose in previous step.
You're ready to run the card and configuration looks like below.
Step 4: Save the flow
Step 5: Test the flow
When the flow runs as scheduled or you run it manually, you should have a card created and displayed on dashboard as shown below.
We have our defined action available as the button on sales insights card.
Click on Extend Close Date. The opportunity will be updated with the new estimated close date and a confirmation message is displayed.
We extended the opportunity's estimated closing date with new action using CRM process.