Hi, does anyone have an idea how to check if the submitter in Message Start Event is in a certain team in Forms? At the moment I have written a stored procedure to check the records in the cf_users, team_members and teams table, but have found that when removing or adding a user to a team, Forms does not delete the record in the team_members but rather update the leave date column or insert a new row with the join date.
This causes an issue as I need to check whether that user is in the team at that very moment regardless of whether the user has joined or left the team in the past. Below is the stored procedure I have written, where I pass the username of the initiator as the input parameter.
CREATE PROCEDURE [dbo].[CheckUserInTeam] @Username VARCHAR(50) AS BEGIN SET NOCOUNT ON; DECLARE @InTeam INT IF EXISTS(SELECT username, email, team_id, name, leave_date FROM cf_users inner JOIN team_members ON team_members.user_id = cf_users.user_id inner JOIN teams ON teams.id = team_members.team_id WHERE username = @Username AND name = 'Management Team') BEGIN SET @InTeam = 1 END ELSE BEGIN SET @InTeam = 0 END RETURN @InTeam END
Thanks