Problem
Firm A has following 3 Users :
User 01
User 02
User 03
ProjectID 12345 was created by User 01 who works in Firm A.
This project was migrated to Firm B and User 03 moved to this new Firm.
Now Firm B has following 2 Users :
User 03
User 04.
Both Firm accounts are active so we cannot disable notification for any of the users.
When new data is added or data is exported from this project, User 01 from the previous Firm continues to receive email notifications. We need to stop this notification.
Resolution
A notification is sent to the user who has created the case. Therefore, we need to change the user who created the project. First, identify the UserId that can be set as the creator on the project. This information can be found in the "tbl_pj_userinfo" table of the VenioPCD database. Afterward, update the "created by" field with the new UserId. Please provide the new UserId that will be set as the "created by" and the ProjectId for which this change needs to be made in the query below, and then execute it in the VenioPCD database:
declare @projectId BIGINT=<Provide projectId that which created by needs to be update>
declare @NewUserId BIGINT=<Provide userid which is set as created by in above project>
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[tbl_jb_EmailNotificationUserGroupAssociation_bak_Change_User_Created_ProjectSetup]') AND type in (N'U'))
BEGIN
SELECT * INTO tbl_jb_EmailNotificationUserGroupAssociation_bak_Change_User_Created_ProjectSetup FROM tbl_jb_EmailNotificationUserGroupAssociation
DELETE FROM U
FROM tbl_pj_ProjectSetup P, tbl_jb_EmailNotification E, tbl_jb_EmailNotificationUserGroupAssociation U
WHERE P.projectid = @projectId AND P.ProjectID=E.ProjectId AND E.Status NOT IN (2,-2) AND E.EmailNotificationID=U.EmailNotificationID AND P.CreatedBy=U.Userid AND U.UserGroupType='U'
DELETE FROM U FROM tbl_pj_ProjectSetup P, tbl_pj_UserProjectAssociation U WHERE P.projectid = @projectId AND P.ProjectID=U.ProjectId AND U.UserId=p.CreatedBy
END
update tbl_pj_ProjectSetup WITH(ROWLOCK) set CreatedBy=@NewUserId WHERE ProjectID=@projectId
Comments
0 comments
Please sign in to leave a comment.