cancel
Showing results for 
Search instead for 
Did you mean: 

Blocking Notification for Sales Opportunity

0 Kudos

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.

Accepted Solutions (1)

Accepted Solutions (1)

former_member185682
Active Contributor
0 Kudos

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

0 Kudos

Hi Diego,

Thanks a lot, the code worked! 🙂

Answers (0)