Skip to Content
0

Blocking Notification for Sales Opportunity

Oct 21, 2016 at 07:29 AM

63

avatar image

Hello Experts!

I'm trying to create a blocking notification for my opportunities module. We plan to block the updating of the opportunity whenever the user fails to provide at least one reason for a "Lost" opportunity. I have created trans notif query for this

DECLARE

@Status as varchar (10),

@Reason as varchar (100)

IF (@object_type = '97' AND @transaction_type in ('A','U'))

BEGIN

SELECT @Status = a.status, @Reason = a.Reason from OOPR a inner join OPR5 b on a.OpprID = b.OpportID

WHERE a.OPPRId = @list_of_cols_val_tab_del

IF @Status = 'L' and @Reason = '' and @Reason is NULL BEGIN SET @error = -97 SET @error_message = 'Please input reason'

END

END

Please advice as to what I can change with this code.

Immediate response would be much appreciated.

Thank you.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
DIEGO LOTHER Oct 21, 2016 at 11:08 AM
0

Hi Nikka,

Try this:

IF (@object_type = '97' AND @transaction_type in ('A','U'))
BEGIN
	DECLARE @Status as varchar (10), @Reason as int
	SELECT @Status = status, @Reason = Reason from OOPR WHERE OPPRId = @list_of_cols_val_tab_del


	IF @Status = 'L' and ISNULL(@Reason, 0) = 0
	BEGIN 
		SET @error = -97 
		SET @error_message = 'Please input reason'
	END
END

Kind Regards,

Diego Lother

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Hi Diego,

Thanks a lot, the code worked! :)

0