Views:

Scenario Overview

In this scenario the business requirement was to add a button to the Account form that would allow the user to quickly create a PDF document containing the last 10 days of audit history.
For this we use the Quick Button App.

Once the PDF document is created, it will be added to the account record as a note.

Button on the Account Form

PDF Document

N52 Formula Manager Solution

The Formula Manager solution works like this,

  • A formula of type 'ClientSide - Calculation' is created to perform the desired action
  • A North52 Quick Button is placed on the Account form **
  • When the button is clicked the formula will execute
  • The FindRecordsAuditHtml() will created the HTML table of the audit entries
  • The CallRestAPI() function is used to call the PDF generation web service (we use HTMLPDFAPI - get 20 free test credits here

  •  

** Instructions on how to add the button to the form are at this link.


N52 Formula Manager Steps

The following set of steps outline how to create this Formula

  • Create a new formula of type 'ClientSide - Calculation'
  • Set the Source Entity to 'Account'
  • Set the Mode to 'Client Side'
  • Copy and paste the formula below into the formula
  • Click save and test

Formula

CallRestAPI(
                          
           SetRequestBaseURL('https://htmlpdfapi.com/api/v1'),
           SetRequestResource('/pdf'),
           SetRequestDetails('Post'),                            
           SetRequestHeaders('Authentication', 
                             'Token XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'),
           SetRequestParams('html', 
                            FindRecordsAuditHtml('account', 
                                                [account.accountid], '10')),
           SetRequestAuthenticationNone(),
           SetRequestFiles(),
           SetRequestExpected('OK'),
           SetRequestActionPass(CreateNote('title', 'account', 
                              [account.accountid], 
                             'note',                                                                 
                             StringFormat('Audit History {0}.pdf',[account.name]), 
                             'application/pdf', GetVar('file')) ),
           SetRequestActionFail(Alert('No PDF Created!'))
)

Configuration of the web resource on the lead entity.