Article Details
Id:19073
Product:finPOWER Connect
Type:NEW
Version:3.04.04
Opened:26/11/2021
Closed:16/03/2022
Released:09/06/2022
Job: J027878

C# Scripting; Summary Page Standard Blocks; Changes made and C# compatibility issues resolved

Changes have been implemented to make it easier to use C# for Scripting "Summary Page Standard Block Override" type Scripts.

The Script Editor has been updated:

  • Removed right-click menu option to "Insert Standard Block (Expanded)"
  • "Obsolete" functions are no longer listed in the right-click menu
  • The standard block stub was previously inserted as Visual Basic code. An attempt is now made to convert this to C#

The C# language is not compatible with certain Visual Basic features hence the following changes have been made for compatibility:

  • C# cannot support:
    • ByRef parameters with default values
    • ByRef parameters after non-byref parameter (or is it Optional parameters?)
    • Optional Date value being set to Nothing or null
      • These have been replaced by " = default(DateTime)" for C#
  • The following functions had optional values for ByRef parameters and, since C# does not support this, the generated code also drops the default value.
    • Account_FinancialStatus
    • Account_MinimumPaymentsDue
    • Client_Summary2
    • Client_SummaryFilteredOut
    • ExternalParty_Summary

The following functions used optional parameters AFTER ByRef which is not allowed in C#. Therefore, the following functions have been added and can now be used instead of the previous, incompatible, versions:

  • Client_Summary3
    • Can be used instead of Client_Summary2 which was not compatible with C#

The following is a simple example of using C# to enhance existing information:

NOTE: C# requires the "ref" keyboard before any ByRef parameters when making a function call. This is inserted automatically in the stub.

public override ISSummaryTables Client_Summary3(ISScriptExecutionInfo callerScriptInfo,
                                                finClient client,
                                                ref ISList includedContactMethodPks,
                                                bool includeClientIdHyperlink = true,
                                                bool includeInvalidContactMethods = false,
                                                bool includeAkas = true,
                                                ISKeyValueList otherParameters = null) {

  ISSummaryTables SummaryTables = base.Client_Summary3(callerScriptInfo, client, ref includedContactMethodPks, includeClientIdHyperlink, includeInvalidContactMethods, includeAkas, otherParameters);

  // Add additional information
  ISSummaryTable SummaryTable = finBL.CreateSummaryTable();
  SummaryTable.TextBefore = "{{info|Testing a C# standard block override.}}";
  SummaryTables.Add("Test", SummaryTable);

  return SummaryTables;
}