Pass value of a People Picker field to another list display or CAML

Nov 11, 2014 at 10:04 AM
I understand that we cant do a lookup on the people picker, so my question is what would be the method to pass the PP query into CAML on another list display.

Is there a way to dynamically update a field in the list from the value of the people picker to do a lookup on it, or is there something that Sp services can do. This functionality should already be inherit to SP in my opinion.
Nov 11, 2014 at 12:34 PM
Edited Nov 11, 2014 at 12:35 PM
I'm not sure what you are trying to do. The People Picker looks up users and gets a "dictionary entry" that incudes details like their name, email, account, etc. You can parse out any of that to use elsewhere.

Nov 11, 2014 at 1:23 PM
Yes, thanks, but I am using a related list that will hide or show a div based on the user selected in the parent list. I am able to this on the parent display list using Spservices and a CAML query but not on the child display list. Does this make sense.
Nov 11, 2014 at 1:30 PM
So you're really not interested in the People Picker, but the value of a Person or Group column. Do you have code that isn't working?

Nov 11, 2014 at 1:36 PM
Let me clarify.

I have list A it contains user info imputed by a people picker.
I have list B this contains the users goals.
I have list C this contains comments to made on users goals.

I have List A and List B related so when you display the page it has the users info and the users goals with links
from the goal title to bring up the List C comments.

Using Spservices and a CAML query I am able to hide certain items in list B, What I need to be able to do
is the same on List C, but can't figure out how to pass the user to list C from List A or B to create logic to hide
the div. The logic is based on the users record.
Nov 11, 2014 at 1:41 PM
try sessvars,js
Nov 11, 2014 at 1:42 PM
Edited Nov 11, 2014 at 1:44 PM
Below is the code that works fine for List A to List B.
<script type="text/javascript" src="http://fnbsvminfo/EmployeeReview/Ops_IT/Scripts/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="http://fnbsvminfo/EmployeeReview/Ops_IT/Scripts/jquery.SPServices-2014.01.js"></script>

<script type="text/javascript">
$(document).ready(function() {
var queryStringVals = $().SPServices.SPGetQueryString(); // The SPGetQueryString function parses the Query String values out into an array
var contentTypeIdValue = queryStringVals["ContentTypeId"]; // This grabs the value of the ContentTypeId Query String parameter
var StringID = queryStringVals["ID"];

// Get the list's Content Types
        operation: 'GetListItems',
        async: false,
        //debug: true,
        listName: 'Operations_IT_Main',
        CAMLViewFields: '<ViewFields><FieldRef Name="Super_Mgr" /></ViewFields>',
        CAMLQuery: '<Query><Where><Eq><FieldRef Name="ID"/><Value Type="Number">' + StringID + '</Value></Eq></Where></Query>',
        completefunc: function(xData, Status) {
            $(xData.responseXML).SPFilterNode("z:row").each(function() {
                //alert(contentTypeIdValue+StringID) // this alert works if the vars are removed from the CAML otherwise it will not
                var supmgr = ($(this).attr("ows_Super_Mgr")).split("#")[1];
                //call function

//... do something with the Content Type Name ...
    // pass qsID into the CAMLquery below

function AddVto(supmgr)

    var thisUserAccount = $().SPServices.SPGetCurrentUser({
    fieldName: "Title",
    debug: false

//alert("This is alert supmgr " + supmgr);
//alert("This is alert logged on user " + thisUserAccount);

   if(thisUserAccount == supmgr)



 // This gets the logged in user" 
//var Username = document.getElementById("zz15_Menu").innerHTML ;
//var end = Username.indexOf("<");
//var nameOnly = Username.split("(")[0];

<!-- table where our speaker rows will go -->
<!--<table id="Table"></table>-->

Nov 11, 2014 at 1:45 PM
It might be easiest to pass the userID on the query string, but you can also use sessionStorage or the like. But why not just read from List A again when you get to list C?

Nov 11, 2014 at 1:48 PM
Yes, trying to figure out how to get the value into the query string that is generated by SP.
Nov 11, 2014 at 1:50 PM
I tried to read to List A from List C but kept getting null.
Nov 11, 2014 at 3:17 PM
You could pass the userID on the query string, something like:


If you're getting null on the read from List C, then you probably just aren't querying properly. Can you show your code?

Nov 11, 2014 at 6:03 PM
Yes, understood, question is in Sharepoint how do you edit the query string in Sp designer when the string is created in SP.
Nov 11, 2014 at 6:39 PM
It'll be something like:
var userID = [id of the user you want to pass];
location.href = "/MyPageName.aspx?userID" + userID;
Nov 12, 2014 at 12:47 PM
Edited Nov 12, 2014 at 1:31 PM
Yes, but here's the mess for the link column, I don't see anywhere where this can be added.

``` <asp:Content ContentPlaceHolderId="PlaceHolderMain" runat="server">
<SharePoint:UIVersionedContent UIVersion="4" runat="server">
<div style="padding-left:5px">
<table cellpadding="0" cellspacing="0" id="onetIDListForm" style="width:100%">
Nov 12, 2014 at 1:02 PM
Are you trying to add a link or button into the standard XslListFormWebPart (which is basically what you've pasted above)?

Nov 12, 2014 at 1:18 PM
No just somehow pass a variable in that link to use for a function
Nov 12, 2014 at 1:25 PM
Edited Nov 12, 2014 at 1:30 PM
Screenshots are better. The first image you can see the related items list with links to detailed views,
The second image is the detailed view, you can also see another set of related items below that to make comments
with links to make comment. Basically I need to hide that comment link based on a user in the parent list.

Nov 12, 2014 at 7:18 PM
Well, I can't really write this for you from here, and I don't really get what you are trying to do. Basically, you've got to write code to make it happen. You can hide or show any element in the DOM you want with script.

Nov 12, 2014 at 11:48 PM
Yes I know, I can write it, it just seems in SP the DOM is gone, The variables destroyed using related lists, and there is nothing to work with.
I am PHP programmer and this does not exist in our world. I'll figure it out one way or another just thought that someone would need to pass values
in Parent,child, grandchild lists, but apparently this has never been done before.
Nov 13, 2014 at 2:53 AM
We do these things all the time. It's absolutely possible, and the DOM is still just the DOM. Don't look at the page as it exists on the server; look at the DOM as it exists in the browser.