1

Is it possible to check if the user has enough permissions to complete task in InfoPath 2010 task form? Or maybe it is possible to show to user read-only view if he has lack of the rights.

The full description of my problem:

Task: approve absence of Pupil by Teacher and if approved add absence to SAP.

I am using next approach: When Teacher press the "Approve" button in InfoPath, first of all I invoke WebService to add record in SAP, and after it I submit the form.

Problem in my approach: if Pupil opens Teacher's task form he can press the "Approve" button and WS will be invoked, but the submiting of form fails, because Pupil can't complete Teacher's task. And, I don't know, how to forbid to invoke WS if there is a lack of the rights.

Possible solutions:

  1. I think, that the better way in my case is to use code not in InfoPath, but in VS. But my WF is created in SPD. In such case I could create custom activity for SPD to invoke WS (or add absence to SAP), but it is an additional module, and I don't want to create it without necessity.
  2. I think it is possible, to do such action using code in InfoPath. But I don't know if it possible to add code to my task form, because I created WF in SPD.
  3. May be I have to do something with user rights (to show read-only view for users with lack of rights).

But may be there is another possibility to do such typical action in SP?

Any suggestions are very appreciated.

1
  • Thanks for marking my answer as best one but I asked to delete it since it really did not provide any solution but just commented on some specifics of Infopath form usage. Oct 26, 2012 at 3:10

1 Answer 1

0

There's a fairly easy way to hide or disable controls based on permissions. See this blog post. Basically, you set up a second list and give everyone read access to it, then you create an item (perhaps put "Yes" as the title) and remove permissions for that item from everyone except for the approvers so that only they can see that item. Then you add that list as a data source. On form load, set a "permissions" field to the first item in the second list. Then set a formatting rule on the "Approve" button such that if the "permissions" field gets set to "Yes" (or whatever the title is), then you hide or disable the "approve" button. So anyone that can read the item in the second list can see the approve button, but it's hidden for everyone else.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.