Forum Discussion

Satish's avatar
Satish
New Contributor II
8 months ago

How to add/remove users/groups via business rules.

Hi Team,

Is there any way to add/remove users/groups via business rule(dynamically). 

i want to add user dynamically i.e not by clicking manually System---Security---Create user.

Thank you in Advance really appreciate. 

 

    • Satish's avatar
      Satish
      New Contributor II

      Thank you so much for taking time RobbSalzmann for posting the above info, really appreciate.

      i already got this info and were able to perform the activity.

      • Krishna's avatar
        Krishna
        Valued Contributor

        Satish  - You can use the below code to delete the group 

         'Read the File
        			 Dim FileReader As New System.IO.StreamReader(folderPath)
        			 'Store the data
        			 Dim stringReader As String = String.Empty
        			 stringReader = FileReader.ReadLine()
                	'Read Each Line
        			 For Each line As String In File.ReadLines(folderPath)
        				'Assign the Security GroupName from File to the String
        				Dim NewSecurityGroupName As String = line
        				Dim objGroupInfo1 As GroupInfo = BRApi.Security.Admin.GetGroup(si, NewSecurityGroupName)
        				
        				If  Not objGroupInfo1 Is Nothing Then
        				
        				'Create a Object for Class Group
        			 	Dim objGroup As Group = New Group()
        				objGroup.Name = NewSecurityGroupName
        					'Create a Object for Class GroupInfo
        				Dim objGroupInfo As GroupInfo = New GroupInfo()
        				objGroupInfo.Group = objGroup
        					'Check the Group Already Exists
        
        						'BRApi.Security.Admin.SaveGroup(si, objGroupInfo, False, Nothing, TriStateBool.TrueValue)
        				BRApi.Security.Admin.DeleteGroup(si,NewSecurityGroupName)
        				BRApi.ErrorLog.LogMessage(si,NewSecurityGroupName &  " " & "Group Deleted")
        			
        			End If	
        			Next
        			FileReader.Close()