Skip to Content
avatar image
Former Member

Transaction Notification

Como puedo poner un transaction notification para que mis usuarios no puedan crear socios de negocios como tipo Cliente, sino que solo se creen como Lead y que solo el usuario de gerencia pueda modificar de Lead a Cliente.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    avatar image
    Former Member
    Jul 19, 2017 at 02:47 PM

    You Can use this.

    1 - Select the users code you want to block :

    select userid, * from ousr

    2 - Put this query on sp_transactionnotification and put this usercodes in the where usersign condition

    --#################################################################
    --BLOCK FROM ADD AS CLIENT
    if @object_type = '2' and @Transaction_type = 'A' 
    BEGIN
    	if (select count(*) from ocrd t0 where t0.cardcode = @list_of_cols_val_tab_del and t0.CardType = 'C' 
    	and t0.UserSign in ('1')) > 0 
    
    
    	BEGIN
    	SET @error = '2'
    	SET @error_message = 'You cannot add BP as Client, please change to Lead'
    	end
    end
    ---################################################
    --BLOCK USERS TO CHANGE TO CLIENT
    
    
    if @object_type = '2' and @Transaction_type = 'U' 
    BEGIN
    	if (select count(*) from ocrd t0 where t0.cardcode = @list_of_cols_val_tab_del and t0.CardType = 'C' 
    	and t0.UserSign2 in ('2')	) > 0 
    	BEGIN
    	SET @error = '2'
    	SET @error_message = 'You cannot change  BP as Client, please contact your manager'
    	end
    end
    

    Its usefull with you do not have to make many changes in this rules. A better way its create an user field in USERS Data and use it as condition.

    Regards,

    Diogo.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member
      Thank you very much,

      I did something similar but the structure of your code is much better, I will test it and I confirm that it was me.

  • avatar image
    Former Member
    Dec 18, 2017 at 06:52 PM
    -1

    Buen día, como puedo hacer dentro del Transaction Notification para obtener el codigo del usuario que esta realizando una actualización?, NO el usuario que guardo el documento (UserSign), he intentado con SELECT &[USER] FROM DUMMY o utilizando @@spid pero no funciona da error en & y @, en Query Manager si funciona pero dentro del TN no, alguna idea? Gracias de antemano.

    Add comment
    10|10000 characters needed characters exceeded