Scenario Overview

The customer's requirement in this article was to have a clickable link that would show the oldest unpaid Invoice on that Account.


N52 Formula Manager Solution


The formula manager solution works like this:
  • We create a formula of type ClientSide-Calculation on the Account
  • The formula will use Fetch-XML to find all the unpaid Invoices on that account in order of oldest due date
  • We select the first record found and create a hyperlink for it
  • If no records found we just return a message saying No Unpaid Invoices

Adding the Button to the Form

  • Open the Form editor
  • Select Insert -> Web Resource.
  • Choose the north52_quick_button_hyperlink.htm web resource
  • Add the Custom Parameters
    • The shortcode of the formula you want to use
    • (Optional) How many pixels from the left you want to move the text
If you have never used Quick Button before you can see more detailed documentation at this link.



  SetVar('All Invoices', FindRecordsFD('FindOldestInvoice','true')),

  SetVar('Oldest Invoice', FindRecordsValue(GetVar('All Invoices'), 'invoiceid', '?')),

  If(ContainsData(GetVar('Oldest Invoice')),

    LinkHyperLinkUrl('', 'invoice', GetVar('Oldest Invoice'), 'Oldest Unpaid Invoice'),

    'No Unpaid Invoices'


<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
  <entity name="invoice">
    <attribute name="totalamount" />
    <attribute name="invoiceid" />
    <attribute name="duedate" />
    <order attribute="duedate" descending="false" />
    <filter type="and">
      <condition attribute="customerid" operator="eq" value="@accountid@" />
      <condition attribute="statecode" operator="eq" value="0" />