User Scripts for ACH Discretionary Fields
This
User Scripts Overview
Millennium® allows you to use VBScripts to set the values for six of the ACH fields.
The fields you can set are:
- In the Batch Header (the 5 record):
- Field 3 — Company Name
- Field 4 — Company Discretionary Data
- Field 5 — Company Identification
- Field 7 — Company Entry Description
- Field 8 — Company Descriptive Date
- In the Detail Record (the 6 record):
- Field 7 — Individual Identification Number
- Field 8 — Individual Name
- Field 9 — Discretionary Data
For more information, see ACH File Formats. Consult the ACH Rules book published by NACHA for complete and current field-specific information.
To enter scripts for ACH files, select System > Setup > Misc tab, select ACHSetup from the drop-down list above the items list, and click on the User Scripts sub-tab. The system displays the User Scripts sub-page:
The other sub-pages are explained in Set Up an ACH Processor.
How to Modify ACH Discretionary Fields
Variables You Need to Know
Variables have been created to transfer data in and out of the scripts. For each ACH discretionary field, you must define a particular return field in your script to copy the data back into Millennium®, known as the return variable.
Table 2-33 presents the six fields and their six corresponding return variables:
The Max Length column indicates the maximum length that is inserted into the ACH record for that field.
The Default column indicates the value the system uses if you do not supply a script on the User Scripts tab. The default is either the value of a field listed in Table 2-34 or contains no text at all (indicated by <blank>).
Additional accessible data fields include:
To access any of the additional fields, prepend AchTrans. to the field name (including the dot). For example, to get the value of the ProcessID field in the VBScript, you would use AchTrans.ProcessID, as shown the example line below:
AchTrans.DetailDiscretionary = AchTrans.ProcessID
In order to test your scripts when you press the Test and Save Script button on the User Scripts screen some data needs to be passed to your script.
The Test Value column indicates what values you can use for testing or where to get them. The value <actualdata> you should use the actual data you entered in your ACH setup (Set Up an ACH Processor).
Edit a Script
The VBScript you write for modifying the ACH fields can become as complex as you want. You have full access to the power of the VB scripting language. However, the end result produced by the VBScript is still only one single string that can fit into the particular field.
To modify an ACH field, select it from the ACH Field drop-down list (User Scripts Overview). The corresponding VBScript for that field is shown in the text area. Use the text box to paste a new script or edit an existing script.
For example, for the DetailRecord / IndividualID field, the default script is just one line:
AchTrans.DetailIndividualID = AchTrans.ID
For that field, no other code is necessary.
You can leave a field script blank. The CreateAch job in Millennium® will default it.
In particular, note the following:
- If multiple companies exist when you process a file and you need to change a discretionary field for just one company, you must keep the default conditions for the other companies.
- In ACH file creation, the system prepends 1 in the front of the company ID in record 6 position 40. It also removes any hyphen characters. The default script also prepends a 1 and remove the hyphens.
If you create a custom VBScript for company ID, you must also add the digit 1 and remove hyphens, if that is the desired result.
- The VBScript for the Detail Discretionary data (record 6, positions 77–78) requires using the Individual ID, since the two values set for the discretionary are the first two digits of the ID.
- If the Bank File Import functionality is being used, the Millennium® company ID needs to be in the Company Name field of the Batch Header record. Accordingly, you should use the following Batch Header/Company Name user script:
AchTrans.BatchCompanyName = achtrans.co + " " + ucase(achtrans.coname)
This will result in the Millennium® company ID, followed by a space, followed by the Millennium® company name (for example, 123DemoCompany).
Test the Script
When you finish editing a script, you must check it for syntax and its result.
Important: In order to save the VBScripts to the Millennium® database you must use the Test and Save Script button. The button does not immediately save the script to the database; instead, it saves the script to the ACH entity that is later saved when you press F11 or click the “Save” icon in the tool bar or by select another tab.
The results you get back might not look like you expect. In order to test a script, some dummy data is passed into the environment (see Table 2-34).
Execute the Script
The scripts are executed when the CreateAch job is running.
Note the following:
- If your script fails, the CreateAch job will default to its internal value and continue.
- If your script returns a result that is too big for your fields, the job will truncate it and continue.
- If no script is found, the job will default to its internal value and continue.
Default ACH Discretionary Scripts
These scripts listed in this section are the default scripts created for Millennium®. If you are adding brand new ACH Setups, the default scripts stored in the database are blank because new scripts are usually added thereafter. If you wish, you can use the default scripts listed here as a starting point.
Batch Header: Company Name
The default script below populates the Company Name field—field 3 in the Batch Header record (the 5 record). The Company Name field begins in column 5 and contains a maximum of 16 characters.
This script populates the Company Name with various possibilities, based on certain conditions:
IF AchTrans.CoNameOnly THEN
AchTrans.BatchCompanyName = UCASE(AchTrans.CoName)
ELSEIF AchTrans.UseSBNameEachBatch THEN
AchTrans.BatchCompanyName = UCASE(AchTrans.ImmediateOriginName)
ELSE
AchTrans.BatchCompanyName = AchTrans.Co & " " & UCASE(AchTrans.CoName)
END IF
IF AchTrans.CoNameOnly AND AchTrans.UseSBNameEachBatch THEN
AchTrans.BatchCompanyName = UCASE(AchTrans.ImmediateOriginName)
END IF
Alternate Scripts for Batch Header: Company Name
You can replace the default, 11-line script above with any one of the alternate, 1-line scripts below. Each of these alternate scripts force the system to populate the Company Name field with a particular value—as opposed to one of several possible values allowed in the default script.
Use the following script to force the system to use the company name:
AchTrans.BatchCompanyName = UCASE(AchTrans.CoName)
Use the following script to use the company code:
AchTrans.BatchCompanyName = UCASE(AchTrans.Co)
Use the following script to use the company EIN:
AchTrans.BatchCompanyName = Replace(AchTrans.CoEIN, "-", "")
Use the following script to use the company FEIN with a leading “1”:
AchTrans.BatchCompanyName = "1" + Replace(AchTrans.CoEIN, "-", "")
Batch Header: Company ID
IF AchTrans.UseSBFedID THEN
AchTrans.BatchCompanyID = "1" + Mid(AchTrans.ImmediateOriginABA, 2)
ELSEIF AchTrans.UseSBNameEachBatch THEN
AchTrans.BatchCompanyID = " " + AchTrans.ImmediateOriginABA
ELSE
AchTrans.BatchCompanyID = "1" + Replace(AchTrans.CoEIN, "-", "")
END IF
IF AchTrans.UseSBFedID AND AchTrans.UseSBNameEachBatch THEN
AchTrans.BatchCompanyID = " " + AchTrans.ImmediateOriginABA
END IF
IF AchTrans.ForceCompanyIdChar <> "" THEN
AchTrans.BatchCompanyID = AchTrans.ForceCompanyIdChar & Mid(AchTrans.BatchCompanyID, 2)
END IF
Batch Header: Company Data
IF AchTrans.CoNameOnly THEN
AchTrans.BatchCompanyData = UCASE(AchTrans.Co)
ELSEIF AchTrans.UseSBNameEachBatch THEN
AchTrans.BatchCompanyData = UCASE(AchTrans.Co) & " " & UCASE(AchTrans.CoName)
ELSE
AchTrans.BatchCompanyData = UCASE(AchTrans.CoName)
END IF
IF AchTrans.CoNameOnly AND AchTrans.UseSBNameEachBatch THEN
AchTrans.BatchCompanyData = UCASE(AchTrans.CoName)
END IF
Detail Record: Individual Name
AchTrans.DetailIndividualName = AchTrans.Name
AchTrans.DetailIndividualID = AchTrans.ID
AchTrans.DetailDiscretionary = AchTrans.Discretionary
Script Examples
You can use the examples below as templates for similar scripts you want to create on your system.
- Changing a single company name when multiple companies exist on file:
IF AchTrans.CoName="SHELL Corporation" THEN
AchTrans.BatchCompanyName="SHE " & "SHELLOILX CORPORATION"
ELSE
AchTrans.BatchCompanyName=AchTrans.CO &" " & AchTrans.CoName
END IF
- Changing a single company data when multiple companies exist on file:
IF AchTrans.CoName="SHELL Corporation" THEN
AchTrans.BatchCompanyData="SHELLOIL2 CORP"
ELSE
AchTrans.BatchCompanyData=AchTrans.CoName
END IF
- Changing a single company ID when multiple companies exist on file:
IF AchTrans.CoName=”SHELL Corporation” THEN
AchTrans.BatchCompanyID=”1987654”
ELSE
AchTrans.BatchCompanyID =AchTrans.CoEIN
END IF
- Changing an individual ID for a specific agency per a specific company:
If AchTrans.CoName="Teradyne 0001" AND AchTrans.ID="ESSPROB1" THEN
AchTrans.DetailIndividualID="MANPOWER"
ELSE
AchTrans.DetailIndividualID=AchTrans.ID
END IF
- Changing an individual name for a specific agency per a specific company:
IF AchTrans.CoName="Stop-Shop Supermarket" AND AchTrans.Name="Norfolk Probation" THEN
AchTrans.DetailIndividualName="8888Morris County Probation"
ELSE
AchTrans.DetailIndividualName = AchTrans.Name
END IF
- Changing discretionary data for a specific company:
IF AchTrans.CoName="Stop-Shop Supermarket" AND AchTrans.Discretionary="NFK01" THEN
AchTrans.DetailDiscretionary="MMK01"
ELSE
AchTrans.DetailDiscretionary = AchTrans.Discretionary
END IF
DBA Information
You can supply “Doing Business As” (DBA) information in discretionary scripts using the special data field code AchTrans.CoDBA.
The AchTrans.CoDBA field pulls its information from the DBA field under [company] > Company Maintenance > Master Company Setup > Demographics tab.
This feature specifically meets the requirements of Nevada state unemployment ACH requirements (NVSUI).
Display Transfer Type
Use the script below to enter the actual transfer item in the 5 record. Using this script allows the client’s bank statements to indicate the transfer type (Billing, Tax, Direct Deposit, and so on) instead of simply indicating “Transfer.”
IF Achtrans.entryDesc = "Transfer" THEN
AchTrans.BatchCompanyEntryDesc = AchTrans.Discretionary
ELSE
AchTrans.BatchCompanyEntryDesc = AchTrans.entryDesc
END IF
Child Support Script to Contain Company FEIN
Batch Header: Company Data
IF Left(AchTrans.discretionary, 9) = "CS-MN SDU" AND
AchTrans.EntryType = "ChldSuppCTX" THEN
AchTrans.BatchCompanyData = AchTrans.CoEIN
END IF
The example above assumes the formatting of the child support agency is nine characters in the “CS-MN SDU” format.
If your format is a different length, change the 9 to a different number.
If your agencies are for states other than Minnesota, create multiple scripts to cover each state and change CS-MNSDU accordingly for each state (CS-ILSDU for Illinois, and so on).