0
votes

I have a Infopath form, published to Sharepoint 2013, in which user selects exactly one person, using a people picker. Outside of form I have columns DisplayName and AccountID. I want user, who is viewing a list, to see only objects which are either modified by him, created by him, or if he was selected in form.

Trying to limit the view from browser-based view creator is most probably impossible, as neither of columns available outside are of type User. I then moved to Sharepoint Designer 2013, and dived into CAML. This did not help either.

How can I check, if currently logged user is the same user, as the one selected in form? I tried using CAML, but to no effect(last FieldRef is reference to column, in this example AccountID).

  <Where>
        <Or>
            <Or>
                <Eq>
                    <FieldRef Name="Editor"/>
                    <Value Type="Integer">
                        <UserID Type="Integer"/>
                    </Value>
                </Eq>
                <Eq>
                    <FieldRef Name="Author"/>
                    <Value Type="Integer">
                        <UserID Type="Integer"/>
                    </Value>
                </Eq>   
            </Or>
            <Eq>
                <FieldRef Name="_638fe3aa_9161_4aa5_8bd1_862678d9fc06"/>
                <Value Type="Integer">
                        <UserID Type="Integer"/>
                </Value>
            </Eq>
        </Or>
    </Where>

If this can be achieved from code in Infopath, or in any other way, the answer will be as well accepted - I do not want exactly CAML based answer, I want any workable answer to my problem :)

1

1 Answers

0
votes

A simple filter in the view for each of the columns you would like to filter on set to [Me] should show logged in users only people picker values that are equal to themselves.

If the field in the form is a people picker then you must be storing the user data in a column somewhere unless you are discarding the data after processing it using a rule to update other fields. If that is the case, I don't see why you can't keep the people picker data stored in a column that you don't display in the view. You do not have to base the filter off of a field you are actively displaying for it to work and you are already using the right type of control to get the data you need.

Created By and Modified By columns are always user values.