Views:

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.


   

North52 Decision Suite Solution


  

The North52 Decision Suite 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.

Formula

 SmartFlow(

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

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

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

    LinkHyperLinkUrl('https://04112016.crm4.dynamics.com', 'invoice', GetVar('Oldest Invoice'), 'Oldest Unpaid Invoice'),

    'No Unpaid Invoices'
  )
)

Fetch-XML

<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" />
    </filter>
  </entity>
</fetch>

Did you know?

North52 TestShield allows rigorous regression testing of your Dynamics 365 system in-sprint

As well as being scheduled, or triggered from build pipelines, TestShield automated tests can be triggered manually for a quick mid-sprint regression test. This allows for quick testing of alternative ways to implement a requirement and measure the impact on existing processes. 

It's quick to clone an existing test and try variations without affecting the original test set up too.

Learn how TestShield can help your Dynamics 365 project