SP Transaction Notification
I have a request from client saying we should create a error message when ever users try to create new vendor and not populating DflAccount field with proper bank account number. I have made a start in SP Transaction Notification, but are having some issues when trying to limit it to only apply for BP of type vendors.The solution I have will actually occur whenever creating a new BP in the system. Maybe I need some modification saying this will only occur when BP is added and not when a BP is updated as well.
If @object_type = '2' begin Declare @PDflAccount as nvarchar(50) Select @PDflAccount = DflAccount from OCRD where Cardcode = @list_of_cols_val_tab_del If (@PDflAccount is null) begin set @error = 1 set @error_message = 'Please enter a bank account number before saving' end end
Appreciate all help.
Best regards, Runar Wigestrand.
try it as
If @object_type = '2' and @transaction_type = 'A'
if exists ( Select top 1 1 from OCRD where Cardcode = @list_of_cols_val_tab_del and cardtype='S' and len(coalesce(DflAccount, '')) = 0)
set @error = 1
set @error_message = 'Please enter a bank account number before saving'