cancel
Showing results for 
Search instead for 
Did you mean: 

Transaction Notification

0 Kudos

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.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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.

0 Kudos
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.

Answers (1)

Answers (1)

Former Member
0 Kudos

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.