Groovy - Unsupported methods .getOrganization()
I'm trying to return the current users Organization for some logic on a page layout. However using the script below it returns null in the logs and when assigning it to a plain text box (just to test). My profile is set up with an organizaztion unit also.
def currentUser = adf.context.getSecurityContext()?.getUserProfile()?.getOrganization()
println("Current user: " + currentUser)
Is the organization method unsupported, or can it be returned another way?
I have also tried '.getOrganizationalUnit()' but with the same result.