Help_Hiding_Form

Hi,

I have some forms built in an app. I have multiple users to access and use the application and all forms. Now I want to hide a particular form (example: Test) from a user "ABCD". I am not aware how to do that. Kindly guide me how to do that.

Thanks for your support in advance.

Regards

Afroz Khan | IT Officer | +91 9415037876 | afroz.khan@crs.orgmailto:afroz.khan@crs.org | Skype: Afroz.khan82
B-116/8, Indira Nagar, Lucknow, Uttar Pradesh 226016 India | crs.orghttp://www.crs.org/

[CRS_Email_Signature_English]

Connect with us on:
[cid:image002.png@01D1CD64.AECAE050]http://www.facebook.com/CatholicReliefServices [cid:image003.png@01D1CD64.AECAE050] https://twitter.com/CatholicRelief [cid:image004.png@01D1CD64.AECAE050] http://instagram.com/catholicreliefservices [cid:image005.png@01D1CD64.AECAE050] https://www.linkedin.com/company/catholic-relief-services [cid:image006.png@01D1CD64.AECAE050] https://plus.google.com/+catholicreliefservices/posts [cid:image007.png@01D1CD64.AECAE050] https://www.youtube.com/catholicrelief [cid:image008.png@01D1CD64.AECAE050] http://www.pinterest.com/catholicrelief/

Hello,

You should be able to do this using the User Case
https://confluence.dimagi.com/display/commcarepublic/User+Case and Form
Display Conditions
https://confluence.dimagi.com/display/commcarepublic/Form+Display+Conditions
.

Cheers,
Will

··· On Mon, Dec 26, 2016 at 6:09 AM, Khan, Afroz wrote:

Hi,

I have some forms built in an app. I have multiple users to access and use
the application and all forms. Now I want to hide a particular form
(example: Test) from a user “ABCD”. I am not aware how to do that. Kindly
guide me how to do that.

Thanks for your support in advance.

Regards

Afroz Khan | IT Officer | +91 9415037876 <+91%2094150%2037876> |
afroz.khan@crs.org | Skype: Afroz.khan82

B-116/8, Indira Nagar, Lucknow, Uttar Pradesh 226016 India | crs.org
http://www.crs.org/

[image: CRS_Email_Signature_English]

Connect with us on:
[image: cid:image002.png@01D1CD64.AECAE050]
http://www.facebook.com/CatholicReliefServices [image:
cid:image003.png@01D1CD64.AECAE050] https://twitter.com/CatholicRelief [image:
cid:image004.png@01D1CD64.AECAE050]
http://instagram.com/catholicreliefservices [image:
cid:image005.png@01D1CD64.AECAE050]
https://www.linkedin.com/company/catholic-relief-services [image:
cid:image006.png@01D1CD64.AECAE050]
https://plus.google.com/+catholicreliefservices/posts [image:
cid:image007.png@01D1CD64.AECAE050]
https://www.youtube.com/catholicrelief [image:
cid:image008.png@01D1CD64.AECAE050]
http://www.pinterest.com/catholicrelief/

--
You received this message because you are subscribed to the Google Groups
"commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

I have the same issue, the suggested solution works when you have case management but for surveys only how it works?

Theogene

Hey there

you can still use display conditions, but you have to reference user properties or session data.

Option 1:
contains('username_1 username_2', instance('commcaresession')/session/context/username) in the display condition of a caselist will hide this caselist from anyone except username_1 and username_2

Option 2:
you can also have a user property "is admin" or something else that you create against your users, and use an expression like this
if(count(instance('commcaresession')/session/user/data/is_admin) > 0, 1, 0)
this expression will return "1" if the user has the property "is_admin" filled for the current user record that's logged in. 1 is true, and so it will show the caselist.

Option 3:
yet an even more fancy option is to leverage organizational structure and locations.
in this expression, i'm checking what location the user is in, and then checking what type of location it is "what level" and if it's a field supervisor, return true.

if(instance('locations')/locations/location[@id = instance('commcaresession')/session/user/data/commcare_location_id]/@type = 'field-supervisormanager',1,0)

you should use the first option if you're doing something quick and dirty and you don't expect to have to change the users that can see the form. i.e. short application use or for testing purposes.
you should use the second option if you do not leverage the organizational structure/hierarchy that commcare provides.

and i personally recommend using the third option as it leverages the built in functionality to organize your mobile workers and case data. this also minimizes the need to change individual user records in order to accomplish this. you can just add users to a location and if that location is a supervisor/whatever you want location then show the forms.

HTH

Mazz