Scenario Overview

In this scenario you need to implement a business rule that will Geo-Encode all the addresses within your Microsoft Dynamics CRM Account entity. This involves using the data within the following fields on the account entity to set the correct longitude & latitude fields on the account entity. 

  • address1_line1
  • address1_city
  • address1_stateorprovince
  • address1_postalcode
  • address1_country

North52 uses Microsoft's Bing geo-encoding service to retrieve the required data & you will need a Microsoft account. This must be configured within the North52 Configuration entity. Click here for more details.

N52 Formula Manager Solution

The Formula Manager solution works like this,

  • Use the ForEachRecord() function to loop over the set of accounts
  • We define the set of account records we want to loop over by using the FindRecords() function & we just use '*' to indicate all records.
  • When we start to loop on the account records we need to define the action that will happen for each record,
  • First use the GeoCodeBing() function to retrieve the data from Microsoft.
  • Now store that result in a variable called 'Result'
  • Finally as part of the SmartFlowReturn, call the UpdateRecord() function which sets the longitude & latitude on the account entity.


N52 Formula Manager Steps

The following set of steps outline how to create this Formula

  • Create a new formula of type N52 Command
  • Copy & paste the formula below into the formula description field
  • Click save
  • Now you are ready to execute the formula against your CRM system. You can do this by clicking the execute button (second last button, on the button list within the formula editor).
  • It will ask you are you sure. Click Ok & the command will execute.
  • When the command completes it will tell you it was successful so you can now go check your account entity to see that the first 50 account records have been geo-encoded



  FindRecords('account', '*', '*', '*', 50), 

  SmartFlow (      
                  GeoCodeBing( CurrentRecord('address1_line1'),
        SmartFlowReturn(  if (GetVar('Result') = '', 'NoOp',
                                                       SetAttribute('address1_latitude',   Split(GetVar('Result'), '|', 0)),                       
                                                       SetAttribute('address1_longitude', Split(GetVar('Result'), '|', 1))   ) )))

Did you know?

It is Faster, Easier and Smarter using North52

We help you deliver Dynamics 365 projects with complex decision logic/business rules:


Our no code business rules engine helps deliver CRM/CDS projects up to 10 times faster than using custom code.


Simple to use point-and-click interface to build simple or complex business rules.


Lower your project risk and slash ongoing maintenance costs.

Learn more about the North52 Decision Suite