Access the Current User's Details in Your Groovy Script

The recommended way to access the current username in your Groovy script is adf.context.getSecurityContext().getUserName(). The only method in the UserProfile object that returns a non-null result is getUserName(), which is the same value as what is returned from the API above. There is no reason to use UserProfile when using Groovy in Visual Builder. For more details, see Referencing Information About the Current User in the Groovy Scripting Reference.