Article Details
Id:14245
Product:finPOWER Connect
Type:NEW
Version:3.00.04
Opened:25/11/2016
Closed:25/11/2016
Released:01/03/2017
Job: J018352

Account Restructure wizard; new scriptable "Print" button

A new scriptable 'Print' button has been added to the Financial Page of the Account Restructure wizard. The button will be shown as disabled as soon as a valid Account is entered, and enabled once on the Financial page and the new Account has been successfully calculated.

This allows a document to be printed, a workflow started etc., but the Restructure not to be committed.

To implement you need to create an "Object Events" type Script for object "AccountRestructure". If you paste in the template code you will see remarked out sample vb.net code. Link this to the "Restructure" Event script for the required Account Types.

The "CanPrintQuote" event determines if the button will be visible, and what its caption is. Simply set the "Caption" parameter to the text you want displayed on the button, and optionally add a Tooltip text.

The "PrintQuote" event is run when the button is clicked. The sample code below creates an Account Document Log and prints the document - but you may do anything you wish here. It is important to save whatever information you require in the Extended Data for later reference and to print in the document etc.

Case "CanPrintQuote"
  ' Indicates whether a 'Print' button should be displayed, and if so the text for the button.
  ' Set the following parameters to enable this function.
  With parameters
    .SetString("Caption", "Print")
    .SetString("TooltipText", "")
  End With

Case "PrintQuote"
  ' Code that runs when a Quote is printed.

  ' Sample code to create an Account Log and print.
  Dim AccountLog As finAccountLog
  Dim kvl As ISKeyValueList

  ' Create Log
  AccountLog = finBL.CreateAccountLog()
  With AccountLog
    ' Other Properties
    .AccountPk = AccountRestructure.Account.Pk
    .DocumentId = "[DocumentId]" ' Replace with your own Document Id
    .LogDbDate = AccountRestructure.RestructureDate
    .LogType = isefinLogType.Document
    .Subject = "Account Restructure Quote"

    ' Extended Data - save details here required for your Letter
    kvl = finBL.CreateKeyValueList
    kvl.SetString("Key", "Value")

    .ExtendedType = isefinLogExtendedType.Xml
    .ExtendedData = kvl.ToXmlString()

    Main = .Save()
  End With

  ' Publish Log
  If Main Then
    Main = AccountLog.Publish(isefinLogPublishType.Publish, True)
  End If

  ' Return a Message to the User
  If Main Then
    With Parameters
      .SetString("Message", "SUCCESS")
    End With
  End If