Scenario Overview

A business that is managing construction Opportunities has many dates which specify key milestone dates for managing a bid. They have several active bids at one time and each bid could be at different stages.

They want to be able to create a view which shows the open Opportunities by the next milestone due and show what that milestone is. 

For this example, the milestone date fields are set up on the Opportunity as:

  • Pre-Bid Meeting
  • Schematic Design
  • Design Development
  • Construction Document
  • Bid Date

Note : You will need to create the following fields for this example:

new_prebidmeeting, new_schematicdesign, new_designdevelopment, new_constructiondocument, new_biddate, new_nextmilestone and new_nextmilestonedate

N52 Formula Manager Solution

The Formula Manager solution works like this:

  • A daily Schedule is set up on the Opportunity entity to run a workflow for each open Opportunity
  • The workflow calls a Process Genie formula which uses the MinOfDatesWithAnchor function to calculate the nearest milestone date and populates a field called Next Milestone Date
  • The formula also uses the FindMatchParameter function to return the name of the field which matches the date returned for the Next Milestone Date
  • A view can now be easily created to show which milestones are approaching for open Opportunities                                                                     

N52 Formula Manager Steps  

The following set of steps outline how to create this Formula:

  • Create a new formula of type Process Genie
  • Set the Mode to 'ServerSide'
  • Set Display Format to 'String'
  • Set the Source Entity to 'Opportunity'
  • Go to the Formula editor
  • Copy and paste the formula below
  • Click Save
  • Copy the Short Code in the top right hand corner for later


Smartflow (

  SetVar('ClosestDate' , 
        [opportunity.new_designdevelopment] ,
        [opportunity.new_biddate]) ) ,

  SetVar ('UpcomingMilestone', 
                          [opportunity.new_designdevelopment] ,
                          [opportunity.new_biddate]))  ,

  SetVar ('UpcomingMilestone', GetAttributeDisplayName(GetVar('UpcomingMilestone')) ),

          SetAttribute('new_nextmilestonedate', GetVar('ClosestDate') ), 
          SetAttribute('new_nextmilestone', GetVar('UpcomingMilestone') )



N52 Workflow Setup

The following set of steps outline how to create this workflow:

  • Go to Settings Processes 
  • Click New
  • Give the process a name
  • For Category , select Workflow
  • For Entity , select Opportunity 
  • Untick Record is Created
  • Tick As an on-demand process
  • Click Add Step > North52 > N52 Process Genie
  • Click Set Properties
  • Past your shortcode formula into Formula Shortcode 
  • Click Save and Close
  • Click Save
  • Click Activate

N52 Schedule

The following set of steps outline how to create this N52 Schedule:

  • Go to Settings > N52 Schedule
  • Click + NEW
  • Give it a Name
  • Set the Frequency to Weekly
  • Leave the ScheduleType as Workflow
  • In Workflow, search for the workflow you created above
  • Choose the Next Run Datetime
  • In the Fetch Xml Query, paste in the below. 
  • Click Save

Fetch Xml

<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
  <entity name="opportunity">
    <attribute name="name" />
    <attribute name="customerid" />
    <attribute name="estimatedvalue" />
    <attribute name="statuscode" />
    <attribute name="opportunityid" />
    <order attribute="name" descending="false" />
    <filter type="and">
      <condition attribute="statecode" operator="eq" value="0" />

Now you ready to test

Did you know?

You can easily copy/clone test data in TestShield

Once you have set up test data with TestShield it is easy to create a copy/clone and make changes. It is centrally stored so that all users creating tests can use the test data in their tests. This approach dramatically reduces the time it takes to create tests, enabling teams to deliver Dynamics 365 projects faster and at less cost.

Learn more about TestShield