This example shows how a user can execute a formula from inside another formula using a function called ExecuteFormula and a formula type called Library Calculation.

This can be useful when a set of steps are used often - having a centralized custom function setup and available allows for ease of access and is simpler to update. 

In this example, we wish to calculate the surface area of a sphere using a centralized formula.

Note: we will use two custom fields called Sphere radius and Sphere surface area.

North52 Decision Suite

The North52 Decision Suite solution works like this:

  • A formula is setup that triggers whenever the custom field Sphere radius changes on an Account
    • This formula will execute another Library Calculation formula
      • The first formula will pass the new Sphere radius value as a parameter into the Library Calculation formula
      • The Library Calculation formula then calculates the surface area of the sphere and passes back the value to the initiating formula
        • Our example uses an xCache record to reference the value for Pi
    • The first formula uses this new value to update the Account record field Sphere surface area


  • Navigate to Settings > N52 xCache
  • Click New
  • Set Category to LibraryCalculations
  • Set the Base Key to LibraryCalculations_Pi
  • Set the Value (Secured) to 3.14159265358979323846
  • Click Save


Library Calculation Formula

  • Navigate to Settings > N52 Formula
  • Click New
  • Set Source Entity to N52 Command
  • Set Formula Type to Library Calculation
  • Select Classic Editor
  • Click Create
  • Set the name to Calculate the surface area of a sphere
  • Open the advanced editor and enter the following formula:
    4 * xCacheGetGlobal('LibraryCalculations_Pi') * Pow(CDecimal([north52_command.radius]), '2') 
  • Click Save
  • Make a note of the Short Code in the top right hand corner, you will need it for the next formula

Standard Formula

  • Click New
  • Set Source Entity to Account
  • Set Formula Type to Save - Perform Action
  • Select Classic Editor
  • Click Create
  • Change the name to Recalculate sphere surface area
  • Expand Source & Target
    • Select Sphere radius
      • Note: this is a custom field, you will need to create it
  • Open the advanced editor and enter the following formula (Note: you will need to swap the below Short Code (Ig9) with the Short Code of your formula. 'new_spheresurfacearea' is a custom field which you will need to create.):
                      ExecuteFormula('Ig9', '', SetFormulaParameters('radius', [account.new_sphereradius])))))
  • Click Save


  • Open an Account record
    • Make sure the two custom fields are added to the form
  • Make a change to the Sphere radius
  • Click Save
  • You should see the results in the Sphere surface area field:

Did you know?

North52 has a powerful distributed cache for advanced decision logic

xCache allows you to configure and scale your Dynamics 365/CRM applications running On-Premise or Online. It allows dynamic system configuration and removes performance bottlenecks related to data storage. xCache provides Dynamics 365/CRM with an extremely fast and scalable distributed cache to power your advanced decision logic.

xCache in Dynamics CRM  lets you cache static application data, and also load dynamic cache items for applications running in a single or multi-server configuration.

Learn more and see examples of xCache