Logic blocks are configured in the Logic Block Builder application.

Name logic blocks so that they are free of numbers, special characters, and spaces. Once a logic block is created, the name cannot be changed at a later date. All words should be written in upper camel case, which means the first letter of each word should be capitalized. The name should reflect the function being performed. For example, CalculateNetValue or CheckInventory.

You should describe your logic block and include descriptions of any logic blocks that are called in the Specification field. The specification is a technical description of the logic block for application developers. Use the Specification field to detail the function and implications of the logic block. If any significant changes are made to the logic block, ensure that the specification is updated accordingly.

Naming conventions and standards

Logic block names should reflect the overall function being performed, for example CalculateRequiredQuantity and ValidateWorkGroup.

If you are creating the logic block to void GL records for an application you need to name your logic block Void<ApplicationName>, and your mini app, from which you run the logic block, <ApplicationName>Void. For example, the application Payments is associated with the logic block VoidPayments and the mini app PaymentsVoid.  Avoid using the term 'wrapper' to describe logic blocks that calls other logic blocks. 

Logic blocks names typically start with verbs. Here is a list of some standard logic block verbs:

VerbUse if the logic block...Example
WriteInserts or updates into a table. All action blocks should start with Write.WriteGLTransaction
RetrieveOnly retrieves data. These are often shared service/ common logic blocks.RetrieveExchangeRate
HideShow  (suffix of Fields or RowActions) Hides or shows fields.  If hiding/showing  row actions, add suffix of Fields.  If enabling/disabling Row Actions, suffix with RowActionsHideShowAddressFields or HideShowInventoryCountRowActions 
IntegrateIs used to move data from an integration table to the actual table.IntegrateStudentSchedule
TestIs a unit test logic block. Test should be the prefix of the logic block name, followed by the primary logic block name.TestValidateCostCenter
Multi Row SelectRuns on the Datatable True/False Click (With Multi-Select) event.MultiRowSelect<ApplicationName>
VoidVoids a transactionVoidWOTransaction
EnableDisable (suffix of Fields)Enable or disable fields.   EnableDisableBankDepositFields
ChangeField Value Change. If logic only runs when a field value change has occurred.ChangeSupplierNameForPOHeader or ChangeGLAccountForPODetail

Variable names should reflect the intended content or value that will be stored in the variable.  Do not place 'Var' or 'Variable' as part of the name.  

Inputs and outputs

When the logic block uses the Inputs and Outputs subtable the following best practices should be used.

  • The Specification field for each row in the Inputs and Outputs subtable should briefly explain how the field or record is used. Reserve larger notes, such as how to call the associated logic block, for the logic block’s Specification field.

  • If the logic block uses multiple fields from the same table you can include each field as aValueinput Type or provide all fields from a larger data source as a singleRecordinput Type. Passing record inputs has a slight performance implication. There are several considerations, such as:

    • If the list of input fields for a single data source may change or grow, you should select the entire data source record instead of individual values. This is a more maintainable approach that minimizes technical debt in the future.

    • If the necessary input fields are well defined and should not be amended in the future, map individual fields as values rather than an entire data source record. 

    • If the logic block is designed for a common use case, constructing individualValueinputs or using a singleRecordinput where the record is a Work Table can make the logic more accessible than using an existing data source.

  • In cases where modification of a logic block’s input data could lead to data integrity issues, such as logic blocks configured with a Security Option of Private, consider the Customization Pattern of the logic block and whether it should be a CompleteLock. 

Naming conventions and standards for inputs and outputs

TypeObject NameInput/output shape
ValueThe standard is to either use the same name as the data item or to choose a name that is as descriptive as possible for your use case. 
OR
Use a generic data item in theFoundation product family, the name should be as descriptive as possible for your use case. 
Select a data item.
OR
Use a generic data item in theFoundation product family. 
  • The naming convention for these fields is LBInputOutputXXX. For example, LBInputOutputText, LBInputOutputDate, and LBInputOutputNumber. There should only be one LBInputOutputXXX for each Type.
    • Only add a new data item for a Type that does not already exist and do not create duplicate data items for the same Type.
    • Ensure the generic data item name and synonym are appropriate for user-facing messages if used in logic blocks that create messages, notification, or log data.  
RecordThe standard is to match the name of the table listed in the Input/output shape, though it is required to be the same if the logic block is used as an application event, a table trigger, or an action block. For example, a shape defined using WorkOrderHeaders, the name should be WorkOrderHeaders.
If there are two records with the same Input/output shape, make the names descriptive as to how each one is being used in the logic block. For example, if there are two SalesOrderDetail:
  • If the logic block is used as an application event, a table trigger, or an action block, then the first Record should be named SalesOrderDetail and the second could be SalesOrderDetailPrevious. 
  • If the logic block is not used in an application event, table trigger, or an action block, then the names could be anything the describes how they are being used (for example, SalesOrderDetailCurrent and SalesOrderDetailPrevious).
Select a table. 

Using inputs and outputs in logic block builder

  • When the called logic block requires a defined set of fields, it is nominally more performant to input only those fields, but any reliance on a large or uncertain number of fields means that the entire record is more valuable for maintainability.

  • Many logic blocks contain an extra call to a common logic block like RetrieveInventoryCommitments: if the calling logic block has already made a call, that logic block can add a dynamic input to the call. 

    • This is more performant than doing the call again when that call would provide the same information as the first call.

    • Certain logic blocks like RetrieveItemOrgUnits are built to be called multiple times and store prior information to provide the caller. In these cases, it is not a problem to call a second time, so the decision to pass input values or call again does depend on the circumstances.

  • Mark outputs that overwrite an object with an inline comment to indicate that the object has changed.

    • For example, WritePurchaseOrders calls a logic block titled DefaultValidateContractsForPODetail and overwrites the header detail DSN in this manner, so it contains an inline comment of: “Output: ProcurementOrderHeader DSN, ProcurementOrderDetail DSN”. 

Using inputs and outputs with header detail structures

  • When a logic block is built over a header detail table (HD) and calls another logic block that uses the same HD structure, you can eliminate a fetch from the called logic block by passing the current detail record as an input. This prevents the need to pass the HD structure alongside a “Current Row” that may then be fetched in the called logic block; instead, the called block has immediate access to the current DSN.

Logic block data source naming conventions

These naming standards ensure that logic block data source names across Nextworld follow the same conventions so that application developers can easily identify and classify them.

Data source names, or the name that you give a logic block action, should be written to reflect the function being formed. Below are examples of data source formats and names for different logic block actions:

ActionData source name formatExample
Add Subtable Record

Add<SubtableName>Subtable

AddEmailsSubtable
Call a Logic Block

Call<LogicBlockName>

CallCreateInvoiceCharges

If you have to call the same logic block multiple times within your logic block, you will want to make the data source names unique. For example, if you have to call the DeriveGLAccount logic block two times in your logic block you can make your data source names: CallDeriveGLAccountAP and CallDeriveGLAccount.

Call Primary Logic Block

(only available for use in Test logic blocks)

<test case name>

TestExactMatchRequestTypeProductDefinition

The primary logic block is usually called multiple times within a test logic block, so using the test case name as the data source will make it easy to identify which call belongs to which test case.

Create HD Structure

<HDTableName>HD

AdminAttendanceHD
Create a Temp Table

<TableName>TT

GLDetailTT
Fetch Records

Fetch<TableName>

FetchReceivablesDetailAll
Fetch a Table Lookup

<FieldName>Pointer

CompanyPointer
Insert Records

Insert<TableName>

Insert StudentGrades [InsertStudentGrades]
Loop Multiple Select

Loop<MultipleSelectionName>

LoopGradeLevels
Loop Subtable

Loop<SubtableName>Subtable

LoopEmailsSubtable
Retrieve Module Settings

<ModuleSettingType>Settings

RetrieveSISSettings
Save HD

Save<HeaderDetailTable>

SaveGeneralLedgerTransactions
Traverse Tree

Traverse<TableName>

TraverseOrgUnitRelationships

Event action best practices

These best practices ensure that logic blocks configured as event actions are built consistently throughout Nextworld.

Logic blocks built on the Logic Builder page in the Logic Block Builder application, and then added to the Actions page in the Application Builder application.

If multiple fields are joined together for a purpose, put all the validations and defaults for those fields into one logic block. For example, the values of fields A and B determine the default of field C. Instead of using separate logic blocks for fields A and B, use one logic block for both fields so that the two values can be validated and provide an appropriate default value into field C in one action rather than multiple event actions. 

When to configure a logic block as an event action, a table trigger, or an action block

These best practices ensure that logic blocks are configured consistently as event actions, table triggers, and action blocks.

Logic blocks can be configured as event actions, table triggers, or action blocks. The way you configure the logic block depends on the function of the logic block and the application or table where it is being used.

Event actions

Event actions run in the UI as a result of user interaction. Configure a logic block this way when:

  • Validation is required before the save is processed. For example, if a field value should be validated and saving the record could take longer, like a header detail record with several hundred details.
  • You want to interact with the user. For example showing warning messages before a record is saved, hiding or showing fields, or populating a field value.

Learn more in Logic blocks and event actions.

Action block

Action blocks are logic blocks that run instead of a save, update, or delete when a user clicks a button to save or delete a record. Action blocks contain logic actions to update the table they are configured for. Configure a logic block this way when:

  • Other families will be inserting records into this table. This ensures there is only one point from which records can be inserted into a table.
  • This logic block inserts and updates transactional records. That is, records that could also result in updates to multiple tables.
  • The logic block should only run conditionally.
  • The table this logic block is built over is only used for data entry, and you want to save the records in a different table.
  • The security should be controlled by the logic block, instead of the table. 

Learn more in Action blocks.

Table trigger

Logic blocks configured as table trigger run any time a record in a table is altered. Table triggers allow you to validate record data and update multiple tables. Configure a logic block this way when:

  • The logic block should run every time a record in the table is altered. For example, if it should run when a user adds a new record, when records are imported to the table, and when another logic block inserts a record into the table.
  • The logic block needs to use the completed record, after it has been saved, validated, and persisted to the table.
  • The logic block is validating the data that is being inserted or updated.

Learn more in Table triggers.