Scenario: Looking to restrict the valid expense accounts during PO entry to specific accounts.
Example Solution:
- Add a custom validation in UD User Validation
- In the SQL tab, insert the code found below. Customize code to use your list of acceptable accounts.
- Press the compile button.
- In PO Purchase Order Entry, Press F3 on the GL Account field.
- In the System Overrides tab, set Validation level to 2-Show error, disallow save or your choice.
- In the Procedure field find the custom validation you created.
- In the parameters field, input 115, 155 to pass the linetype and GL Account to the validation.
- Test the validation in a test environment to make sure if functions as expected.
SQL Query
/** User Defined Validation Procedure **/
/** Purpose: To restrict PO Entry with LineType 3 to Specified GL Accounts. **/
/** Created by Constructive Tech Solutions 3/19/2018 **/
(
@linetype INT
,@GLAcct char(20) = Null
,@msg varchar(255) output
)
AS
declare @rcode int
select @rcode = 0
IF
@linetype = 3 AND @GLAcct NOT IN ('99300.', '99250.') --The Acceptable GL Accounts are listed here with a comma seperator
BEGIN
SELECT @rcode=1,@msg='Error invalid expense account for this PO Line Type' --Customize the error message here
END
spexit:
return @rcode
Leave A Comment