Article Details
Id:19509
Product:finPOWER Connect
Type:NEW
Version:4.00.00
Opened:30/08/2022
Closed:30/08/2022
Released:21/12/2022
Job: J029485

Xero API Interface; added optional "Reference" properties for Bank Transactions

The Xero API Interface now includes optional "Reference" properties for Bank Transactions that can be scripted.

These properties are:

  • finGlExportBankTransaction.Xero_Reference
  • finGlExportBankTransactionLine.Xero_Reference

They would normally be left blank to use standard functionality - but a script can override as required. These will appear in the transaction created in Xero.

Here is a code snippet for a "GLExportNew" Object Events script. For imported Bank Transactions this sets the Reference on the Transaction to the imported "Other Party" detail and on the Lines to the Particulars, Code and Reference.

Select Case eventId
  Case "ExportProcess"
    Dim BankTransactionView As finBankTransactionView
    Dim GlExportBankTransaction As finGlExportBankTransaction
    Dim GlExportBankTransactionLine As finGlExportBankTransactionLine

    ' Create Objects
    BankTransactionView = finBL.CreateBankTransactionView()

    For Each GlExportBankTransaction In GlExportNew.BankTransactions
      If GlExportBankTransaction.BankTransactionPk <> 0 Then
        If BankTransactionView.LoadFromBankTransactionPk(GlExportBankTransaction.BankTransactionPk) Then
          If BankTransactionView.IsImported Then
            GlExportBankTransaction.Xero_ContactId = "" ' Set to something?
            GlExportBankTransaction.Xero_Reference = BankTransactionView.ImportedDetailsForDisplay.GetString("OtherParty")
              
            For Each GlExportBankTransactionLine In GlExportBankTransaction.Lines
              GlExportBankTransactionLine.Xero_Reference = String.Format("{0} {1} {2}", BankTransactionView.ImportedDetailsForDisplay.GetString("Particulars"), BankTransactionView.ImportedDetailsForDisplay.GetString("Code"), BankTransactionView.ImportedDetailsForDisplay.GetString("Reference"))
            Next
          End If
        End If
      End If
    Next