Skip to Content
avatar image
Former Member

Blocking Notification for Sales Opportunity

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.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Oct 21, 2016 at 11:08 AM

    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

    Add comment
    10|10000 characters needed characters exceeded