SetErrorCode

The SetErrorCode function adds an error code to 1 of two accumulating sets. The two data fields used to return error codes to a client application such as Gateway are ibmValResults and ibmNprValidationResults. SetErrorCode automatically adds the error code to the appropriate results data field.

When an ACH transaction is processed, the Gateway client applications send the following records to Business Rules.
  • The item record, which is record type 6.
  • Zero or more addenda records, which are record type 7.
The ibmValResults data field is used to associate error codes with an actual record. The error codes are assigned to the actual record that caused the error to occur, which is done automatically by the validation nodes. For example, when an error is detected on an IAT addenda 13 record, the error is tied to that record so that the client application can properly associate it in the database.

The ibmNprValidationResults data field is used to associate error codes with the message. For an ACH transaction, the error code is associated with the transaction itself, regardless of which record caused the error code.

The first parameter of SetErrorCode is the error code. The second, optional parameter is the addenda number of the addenda record with the error. When multiple addenda records have the same addenda number, the error code is assigned to the first addenda record in the set. You can use collectors to apply to the error code to the specific record.

The return value indicates whether the operation was successful. The operation fails if the error code is unknown. Using the return value is optional.

Return type

The function return type is: BOOLEAN

Function parameters

Table 1. SetErrorCode assignment function parameters
Parameter order Input variable type Parameter data type Required parameter Description
1 Valid types are:
  • Data field
  • Constant
STRING Yes The error code.
2 Constant STRING No The addenda number.

Example

The following XML shows an example of using the SetErrorCode function in an assignment element. The errorDetected data field is set before this assignment function is called.
<taskDescriptor name="TaskName" type="ASSIGNMENT">
   <assignments>
      <assignment field=""         type="SetErrorCode" value="'EC101'"        conditions="errorDectected EQ 'Y'/>
      <assignment field=""         type="SetErrorCode" value="'EC102', '13'"  conditions="errorDectected EQ 'Y'"/>
      <assignment field="success"  type="SetErrorCode" value="'EC103'"        conditions="errorDectected EQ 'Y'"/>
   </assignments>
</taskDescriptor>
In this example:
  • The first assignment statement calls SetErrorCode to add error code EC101 to ibmNprValidationResults.
  • The second assignment statement calls SetErrorCode to add error code EC102 to ibmValResults and to associate it with addenda record 13.
  • The third assignment statement calls SetErrorCode to add error code EC103 to ibmNprValidationResults and to set the success data field to either Y or N.