How to hide a field in AEM6 adaptive form based on logged in user | Community
Skip to main content
Level 2
October 16, 2015
Solved

How to hide a field in AEM6 adaptive form based on logged in user

  • October 16, 2015
  • 1 reply
  • 1269 views

I'm trying to find a way to hide a particular form field in the Adaptive AEM6 form based on the user that is signed in. I looked a the source code and it seems that the form fields are in .contenxt.xml file. I'm not sure how I can manipulate this to meet the above requirement. 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by ifconfig
Session userSession = slingRequest.getResourceResolver().adaptTo(Session.class);

String userId =  userSession.getUserID();

You can do many othre things  like getting userManager , authorizable etc once you have the session.

You can set a flag in JS and based on that flag write visibility expression on that field 

1 reply

ifconfigAdobe EmployeeAccepted solution
Adobe Employee
October 16, 2015
Session userSession = slingRequest.getResourceResolver().adaptTo(Session.class);

String userId =  userSession.getUserID();

You can do many othre things  like getting userManager , authorizable etc once you have the session.

You can set a flag in JS and based on that flag write visibility expression on that field