Forum Discussion

DK_OS's avatar
DK_OS
New Contributor
2 days ago
Solved

How to export data out of BR

Hi All, I created a Business Rule to export all the GROUPS that i have in OS applciation. i try to export the data in a file. i tried below option , it did not work created BR and executed ther...
  • MarcusH's avatar
    2 days ago

    I don't know why you are making things complicated. sameburn​ gave you a great starting point. I have updated your script.

    Try
    	' Get all security groups
    	Dim groupsObj As List(Of Group) = BRApi.Security.Admin.GetGroups(si)
    
    	' FORMATTED OUTPUT FOR EASY VIEWING
    	Dim output As New List(Of String)
    	output.Add("=== SECURITY GROUPS LIST ===")
    	output.Add("Generated: " & DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"))
    	output.Add("")
    	
    	For Each varGroup As Group In groupsObj
    		output.Add(varGroup.Name)
    	Next
    	
    	output.Add("")
    	output.Add("=== END OF LIST ===")
    	output.Add("Total groups: " & groupsObj.Count.ToString())
    	
    	BRApi.ErrorLog.LogMessage(si, output.ToString)
    	
    	Return Nothing
    
    Catch ex As Exception
    	Throw ErrorHandler.LogWrite(si, New XFException(si, ex))
    End Try

    Extender rules do not return anything so you will either have to save the file to the fileshare (search this forum for XFFile) or to your user temp folder (search for usertemp in the BR help).