Hidden value to retrieve current user's organization

Hello,

I know this allows you access the current user: instance('commcaresession')/session/context/userid

Is there a way to retrieve the organization site code to which the current user belongs within a form using a hidden value?

Thank you,
Alejandro

Hello Alejandro!
Yes, you can retrieve the organization site code to which the current user belongs within a form using a hidden value. The expression to use is: instance('locations')/locations/location[@id = instance('commcaresession')/session/user/data/commcare_location_id]/site_code

1 Like