Tutorial 4 - Create a reminder for opportunities closing soon

Completed

You will need either a trial environment or a sandbox environment with Sales Insights to complete these tutorials.

Objective

Show a reminder for opportunities closing in the upcoming seven days.

Step 1: Set up a daily recurrence trigger

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.

Recurrence search results show the Recurrence Schedule on the Triggers tab.

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're setting At these hours as 8, as we want the trigger to run every morning at 8 AM.

The At these hours property is set to 8.

Step 2: Fetch all opportunities closing in the next seven days

Start with getting all opportunities in the org. Use the Dataverse connector for this as shown in the "Hello world" example. Use the "list records" action of the Dataverse connector and choose "Opportunities" in the Table Name column drop-down.

List records action has the Table name set to Opportunities.

Users familiar with OData filters can take the following approach.

In the "Filter Query" column use estimatedclosedate le @{addDays(utcNow(),7)}. This will filter out and get all opportunities with an estimated close date less than seven days from utcNow.

The Filter query is set to estimatedclosedate le addDays(...).

Users unfamiliar with OData filtering can take the following approach.

For all opportunities fetched, use a condition to check if estimated close date is within a week. Refer to the screenshots below for step-by-step guide.

Search "condition" to get conditional action in flow.

The Condition value is selected and the Dynamic content window has the search term close date.

Search for estimated close date in Dynamic content and select the same for the value in the condition.

You'll notice that the condition got embedded in an "Apply to each" action as the input given was from list (list of opportunities).

Create the condition for estimated close date. Here we use the estimated close date less than or equal to seven days from utcNow.

Close condition is set to is less than or equal to, and addDays(utcNow(),7) is on the Dynamic content Expression tab.

Step 3: Create the insights card

Now to create the card, use the Sales Insights connector in the true part of the condition. Fill in the columns with required columns. You can use the output of the opportunities to create relevant cards for each opportunity. Since the condition and the create card action are inside the "Apply to each" action, they'll run for each opportunity.

Create card for assistant 2 is the action for the If yes condition.

Create card for assitant details show all required columns and several advanced options set.

We have chosen "Open table" as the Button type, hence we gave the Opportunity unique identifier as the record ID and chosen "opportunities" as the Button table.

Also observe the other columns, where we have given opportunities and its ID in the "Display table" and "Display record ID" columns. The "Show for" column is set as the Owner of the opportunity to show the card to the respective owner.

Need help? Reach out to us via our community forums.