on 04-12-2009 6:27 PM
Dear Experts,
I want to set some fields in Sales Opportunity as mandatory and I think can be possible through SP transaction notification but am not able to write procedure.
I want the followings fields to be set as mandatory and the document does not get saved untill and unless these fields are not put. The fields are from Sales Opportunity as under :
1) Opportunity Name
2) Contact Person
3) Territory
4) Sales Employee
I know the object for Sales Opportunity seems to be 97. Would be thankful if you can help me in writing the SP.
Thanks in advance.
Regards,
Kamlesh
It may be easier if you make a stored procedure to handle those issues.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
Use the following SP:
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
ALTER proc [dbo].[SBO_SP_TransactionNotification]
@object_type nvarchar(25), -- SBO Object Type
@transaction_type nchar(1), -- [A]dd, <u>pdate, [D]elete, [C]ancel, C[L]ose
@num_of_cols_in_key int,
@list_of_key_cols_tab_del nvarchar(255),
@list_of_cols_val_tab_del nvarchar(255)
AS
begin
-- Return values
declare @error int -- Result (0 for no error)
declare @error_message nvarchar (200) -- Error string to be displayed
select @error = 0
select @error_message = N'Ok'
IF (@transaction_type = 'A' or @transaction_type = 'U') AND @object_type = '97'
BEGIN
if exists (Select T0.cardcode from OOPR T0 where ((T0.Name is null) or (T0.cprcode is null) or (T0.territory is null) or (T0.slpcode =-1)) and (T0.opprid = @list_of_cols_val_tab_del))
begin
SET @error = 10
SET @error_message = N'Some of the Fields are Null'
end
END
-- Select the return values
select @error, @error_message
end
User | Count |
---|---|
91 | |
10 | |
10 | |
6 | |
5 | |
5 | |
5 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.