Hide the form based on permissions in nintex form


Badge +3

Is it possible to redirect user to different page, when trying to access others forms ?

 

I am trying to achieve a condition 'if employee is not equal to current user and if employee is not part of a SharePoint group(this will be Approvers), should redirect to different page'. Typically no one should have the access, once the form is submitted other than the Approver and current user. Is this possible in nintex forms?

 

Please advice me how to proceed on this? 


14 replies

Userlevel 5
Badge +14

'if employee is not equal to current user and if employee is not part of a SharePoint group(this will be Approvers), should redirect to different page'

when exactly do you want the redirect to happen?

after form submit? or do you want to forbid access to a item/document once it is submitted?

and where do you want to happen it, list or library?

no one should have the access, once the form is submitted other than the Approver and current user

that's a bit confusing.

everyone authenticated by sharepoint is being treated as 'Current user'.

whom do you mean by current user?

Badge +3

Hi Marian,

Thanks for your reply.

For the first set of questions, I have a list with multiple items created by different users. I want to restrict access to users, trying to view/edit other items which are not created by them. So I want the user to redirect to different page or give some error 'you do not have access to this item'. 

For the second set, the current user is the person who logged in when submitting a form. I have a column employee name on the form, So I am checking when the current user is equal to employee or not. 

To be more simple I have added a panel on nintex form and I want to hide the panel when, if the current logged in user is not equal to the employee name on the form or part of a particular SharePoint group.

Hope this clears your questions.

Jagdeesh

Userlevel 5
Badge +14

I want to restrict access to users, trying to view/edit other items which are not created by them. So I want the user to redirect to different page or give some error 'you do not have access to this item'. 

hmm, do you really need a redirect?

exactly that what you ask for can be configured in list settings. wouldn't that be an option for you?

if you configure it this way, users will even not know about existence of other items created by other users.

212052_pastedImage_1.png

To be more simple I have added a panel on nintex form and I want to hide the panel when, if the current logged in user is not equal to the employee name on the form or part of a particular SharePoint group.

this can be achieved with formatting rule.

if I got you description right, then formula like following should satisfy it.

or(not(userEquals(Current User,UserNameNamedControl)), not(fn-IsMemberOfGroup("SP.TESTGroup")))

take care of correct configuration of respective references!

212053_pastedImage_6.png

Badge +3

Hi Marian,

Thank you for taking time and answering my question. Really appreciate it. 

I know there is an option in advanced settings to restrict the users access, but I can not change these settings as it effect the other part of the requirement. This is the reason why I'm looking for work around for the List item security. 

I have changed the references and tested the formatting rule, the conditions in the rule are working separately but not working together in or condition. 

Userlevel 5
Badge +14

ok, I see.

there is no such functionality that would decide (redirect) what form/page to open based on who actually opens it.

if you want to restrict access to certain items to only certain users/group you have to configure item level permissions accordingly. so you will need to break existing/inherited permission and grant permission only to creator and approver.

you can maintain it manually or you can do it from workflow - see Set Item Permission workflow action.

reg. formula to hide panel:

does it throws any error or does it just logically work incorrectly?

I'm not sure whether I correctly understood you description

I want to hide the panel when, if the current logged in user is not equal to the employee name on the form or part of a particular SharePoint group.

I uderstood it as:

panel has to be hidden when (the current logged in user is not equal to the employee in a form control) OR (the current logged in user is not member of a particular SharePoint group)

so the panel should only when current user is  group member AND it is as well select employess in form control.

let me know if my understanding is wrong.

Badge +3

Hi Marian,

Yes it is returning an error.

212094_pastedImage_1.png

When I tried these conditions separately they are hiding the panel fine with the error in return

212093_pastedImage_2.png

Yeah you're right. The panel should be hidden if (the current logged in user is not equal to person who created that form i,e. created by) OR if (the current logged in user is not part of a SharePoint group )

Userlevel 5
Badge +14

it looks like you have some syntactical error on a form and string "fn-IsMemberOfGroup" is not recognized as function name but as math expression.

check whether you do not miss or do not have one more parenthesis, quote, comma, etc. (note the problem need not be in this specific formula)

you might as well look on developer console what errors it reports.

Badge +3

Hi Marian,

Can you please tell what I am doing wrong here.

212104_pastedImage_1.png

Thanks

Userlevel 5
Badge +14

you have a typo in function name (doubled 'u') happy.png

Badge +3

Hi Marian,

Sorry for the typo. It is not working even if I removed the u from the expression.

Userlevel 5
Badge +14

check developer console what errors are reported there.

if you are not able to resolve them on your own, post a screenshot here, plus post few lines of code where each error points to.

add few calculated value controls on the form, one for each formula of following

CurrentUser

CurrentUserLogin

userEquals(CurrentUser,CurrentUserLogin)

not(userEquals(CurrentUser,CurrentUserLogin))

fn-IsMemberOfGroup('HR Approvers')

not(fn-IsMemberOfGroup('HR Approvers'))

or(not(userEquals(CurrentUser,CurrentUserLogin)),fn-IsMemberOfGroup('HR Approvers'))

do type in functions manually, select them within builder from function list!

(for fn-IsMemberOfGroup copy it over from some inline formula)

Badge +3

Hi Marian,

I tried to solve the problem. Here is the expression which i used to solve the issue. 

212198_pastedImage_1.png

This is how it works, the Item will only display to the user when the current logged in user is equal to created by or when an user is part of the particular SharePoint Groups. 

The Expression you provided gave me a lead to solve my issue. Thanks for all your help happy.png

Userlevel 5
Badge +14

you have changed your requirement a bit, but that's great you come to the solution.

please select a correct answer.

Badge +3

In the above expression I am checking whether the current user belong to any one of the SharePoint groups. This is the only thing that have changed in my requirement, but everything is still the same. 

I have tried various formulas and in that process I have tried 'and' and switched the conditions in the formula you provided me and it started it working the way I wanted. 

Anyways I marking the formula as an answer which provided me lead in solving this issue.

And thank you again for your time and quick response happy.png 

Reply