Dear Experts,
I want to create an approval procedure for Journal Vouchers.
I did the following:-
- I created a UDF - MD-Approval on accounting - Journal transactions header with valid values of Pending, Declined and Approved. Pending is the default value. The field is a mandatory field.
- I made the MD the only user who can edit this field by creating a category in Settings- Fields - setup that is relevant to him only
- I created a stored procedure to block posting of journal Vouchers unless the UDF status reads "approved"
--------- Block unapproved Journal Voucher-----
if @object_type = '30' and @transaction_type IN ('A', 'U')
BEGIN
IF Exists (Select T0.TransID from dbo.OBTF T0
WHERE T0.TransId=@list_of_cols_val_tab_del and U_MD_APPROVAL <> 'Approved')
select @error = 101, @error_message = 'This Journal Voucher requires MD Approval'
End
The stored procedure above is not working and journal voucher are processed irrespective of the udf field status. Kindly review and let me know what is wrong with it.
Regards
George Njuguna