Customizing D365 Sales - For Our Own Sales Team (Customer Zero) (2) Common Settings
This continues from Part ①. In Part ②, we'll configure the common settings and the internal-processing Power Automate flows.
Common Settings
Setting Up Connections
- Open Power Automate (https://make.powerautomate.com)
- Go to "Data" → "Connections" → "New connection" and create a Microsoft Dataverse connection
- Do the same to create an Office 365 Outlook connection
Basic Flow Creation Steps
- Click "Create" → select "Automated cloud flow" (event-triggered) or "Scheduled cloud flow" (recurring)
- Name flows in the format
[Zone]-[Number] [Description](e.g., "A-1 Opportunity Stage Stall Alert") - Always run a test after creating a flow to verify it works
2. Internal-Processing PA Flows - 4 Flows (Write-back portions of A-4, C-5, C-6, D-3)
Once the common settings are done, it's time to build.
A-4: Write Back Stage Changed Date
Without this flow, the stall-day calculations in A-1 and B-1 will not work. Implement this first.
In Microsoft Dynamics 365 (D365), a "stage" refers to a major milestone in a process - such as a sales deal or customer engagement - that guides the responsible person through what needs to happen next. It's how a series of activities is visualized and managed.
From here, all work is done in Power Automate.
| Step | Task | Details |
|---|---|---|
| 1 | Create the flow | "Automated cloud flow" → select trigger "When a row is added, modified or deleted (Dataverse)" |
| 2 | Configure trigger | Table: Opportunities / Change type: Modified |
| 3 | Add condition | Add a "Condition" action: "When Status Reason (statuscode) has changed" |
| 4 | Write-back action | "Update a row (Dataverse)" → set cr917_stage_changed_date to utcNow() |
C-5: Auto-Set Renewal Date + Auto-Create Renewal Opportunity (on Won)
On Won close, two things happen: ① auto-set the renewal date to close date + 365 days, and ② auto-create a new Opportunity for the renewal cycle and add it to the pipeline.
| Step | Task | Details |
|---|---|---|
| 1 | Create the flow | "Automated cloud flow" → trigger "When a row is added, modified or deleted (Dataverse)" |
| 2 | Configure trigger | Table: Opportunities / Change type: Modified |
| 3 | Add condition | Process only when "Status (statecode)" changes to "Won" |
| 4 | Calculate renewal date | "Variables" → "Initialize variable" (Date type), set to addDays(triggerOutputs()?['body/actualclosedate'], 365) |
| 5 | Write back to Account | "Update a row (Dataverse)" → set cr917_renewal_date on the Account to the variable |
| 6 | Auto-create renewal opportunity | "Add a new row (Dataverse)" → Table: Opportunities. Subject: original name + " - Renewal " + (close year + 1) + "". Account: same Account ID. Owner: same owner ID. Estimated close date: cr917_renewal_date value. Estimated amount: same as original. Stage: "Prospect" (first stage). Description: "Auto-generated - Created from Won close of " + original name |
| 7 | Prevent duplicate creation | Before running the flow, add a condition to check whether a renewal opportunity with the same name already exists. Skip if it does. |
C-6: Write Back Last Activity Date
This flow runs only when a completed activity (statecode = 1) is created or updated. It does not trigger on scheduling a new activity.
| Step | Task | Details |
|---|---|---|
| 1 | Create the flow | "Automated cloud flow" → trigger "When a row is added, modified or deleted (Dataverse)" |
| 2 | Configure trigger | Table: Activity Pointers (activitypointers) / Change type: Added or Modified |
| 3 | Add condition | Process only when statecode equals "1 (Completed)" |
| 4 | Get related Account | "Get a row (Dataverse)" → retrieve the Account linked via the activity's regardingobjectid |
| 5 | Write back to Account | "Update a row (Dataverse)" → set cr917_last_activity_date to utcNow() |
D-3 (Write-back portion): Auto-Record Invoice Issue Date
| Step | Task | Details |
|---|---|---|
| 1 | Create the flow | "Automated cloud flow" → trigger "When a row is added, modified or deleted (Dataverse)" |
| 2 | Configure trigger | Table: Opportunities / Change type: Modified |
| 3 | Add condition | Process only when cr917_invoice_sent changes from false → true (retrieve the previous value via triggerOutputs() and compare) |
| 4 | Write back issue date | "Update a row (Dataverse)" → set cr917_invoice_date to utcNow() |
Continued in Part ③.
Comments
No comments yet. Start the discussion.