Views:

Overview

This how to article will show you how to pass a a field on the source record into a formula detail record (i.e. fetch-xml query). 

Scenario  

You need to apply a business validation rule where if a new order is being created, check to see if there is more than 50k worth of invoices outstanding for the customer associated with the new order. And if so present an error to the user and cancel the creation of the order. The tricky part here is passing in the customer id from the source record (i.e. on the order record) to the Fetch-XML query when the formula executes. This allows us to find all the unpaid invoices associated with the customer that you are creating the order for.

Steps

  • Create a new formula and set it up like the screenshot below:

  • Next navigate to the Advanced Find form and create a query like the one below:

  • When complete download the Fetch-XML
  • Open the Fetch-XML sheet of the Decision Table, expand Cell A1 and type TotalOpenInvoices.
  • Expand Cell B1 and paste the contents of the Fetch-XML into this cell.
  • Where you see the condition for the customerid attribute change the guid value to a parameter, as shown below:

                  e.g.   value="{9528DA16-9E23-E211-B24B-984BE17C9A40}"  to   value="{0}"

  • This tells North52 Decision Suite to pick up the first value from the SetParams() function in the FindSumFD() function and inject it at runtime into the Fetch-XML so that you get all the unpaid invoices for that particular customer
  • You can now click save on the ribbon and test the formula