Custom Validation Example
 
Below is an example of a custom validation written to validation AP transaction lines coded to Fixed Asset G/L accounts to see if they meet the capitalization threshold.
 
To create a validation on the GL accounts on AP Trans. Entry or AP Unapproved Trans. Entry when the G/L account is a Fixed Asset account, you can use the following steps. It is a good idea to test this in a test database before impacting your live database.
 
  1. In UD User Validation Create a new record for the Validation such as udAPFixedAssetThreshold.
  2. In the SQL tab, enter the validation code listed at the bottom. Be sure that the GL Accounts listed are in the correct format and include the separators for your code format. Update the capitalization threshold dollar amount as required.
  3. Save the validation and run the Compile button at the bottom of the form.
  4. In AP Transaction Entry entry or AP Unapproved Transaction Entry form, press F3 on the Gross Amount field and go to the System Overrides tab. (You can also create a custom field just for validation, set the tab order and hide it from the form).
  5. In the validation section, set the level to your preference such as Warning allow Save if you want to allow save.
  6. Select the Custom validation from the lookup on the Procedure field.
  7. Select the link button to link the form field to the input parameters for the validation, or in this example you can enter 205,240 in the Parameters field.
  8. Click OK on the Field Properties form and it will reload the entry form.
  9. Test your validation to ensure it works as you expect.
 
/** User Defined Validation Procedure **/ 

/** Purpose: Used to validate AP Entry lines to see if lines coded to Asset Accounts meet threshold. **/

/** Created by Constructive Tech Solutions 4/20/2018 **/

(
	@GLAccount char(20) = NULL
	,@lineamount numeric(12,2)
	,@msg VARCHAR(255) OUTPUT  
) 
AS

DECLARE @rcode int
SELECT @rcode = 0

	IF @GLAcct IN ('18020.', '18040.','18060.')  --The 
        Acceptable GL Accounts are listed here with a comma 
        seperator 
	AND  @lineamount >= 4999.99

BEGIN

	SELECT @rcode=1,@msg='Caution: Verify Line is an Asset or
        Recode to Expense Account' end

SPEXIT:

RETURN @rcode