Michael Collins

Forum Replies Created

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • in reply to: vLookup from New on separate list #14162
    Michael Collins
    Participant

      Thank you again, Alexander! Your advice in Reply #14139 was exactly what I needed! Now I have four hours before the demo to clean up the rest of the page. ;~)

      in reply to: vLookup from New on separate list #14101
      Michael Collins
      Participant

        Hi, Alexander. Thank you so much for the help you provided for my original question. I’ve been able to modify the javascript in order to retrieve info from the Employee List on creation of a New list item, even when the child list is in a different site, which is awesome. I’m struggling with another variation, though, to which there’s likely a simple answer that I’m just not seeing.

        The task now is to retrieve Employee List information for an employee other than the logged-in user; rather, the logged-in user will select another SharePoint user from either a People-Picker field (my preference) or a lookup list populated from the Employee List — I’ve tried both. Here’s the code I’m using now. I suspect I need to pass different information in place of the <UserID /> parameter, but I can’t find the right syntax.

        Employee_PP is the name of the People Picker field in the child list, and a DFFS rule calls the function GetEEListData when the value of Employee_PP is changed.

        function GetEEListData(){
        alert(“Running function GetEEListData”);

        var res, qb = [], item;
        qb.push(“<Where>”);
        qb.push(“<Eq>”);

        // THE FOLLOWING RETRIEVES ZERO RECORDS
        qb.push(“<FieldRef Name=’Sharepoint_x0020_ID’ LookupId=’TRUE’ /><Value Type=’Integer’><FieldRef Name=’Employee_PP’ /></Value>”);

        // THE FOLLOWING RETURNS INFO ABOUT THE LOGGED-IN USER:
        // qb.push(“<FieldRef Name=’Sharepoint_x0020_ID’ LookupId=’TRUE’ /><Value Type=’Integer’><UserID/></Value>”);

        // THE FOLLOWING RETRIEVES ZERO RECORDS
        // qb.push(“<FieldRef Name=’Employee_PP’ LookupId=’TRUE’ /><Value Type=’Integer’><UserID/></Value>”);
        qb.push(“</Eq>”);
        qb.push(“</Where>”);
        res = spjs_QueryItems({“listName”:”Employee List”,”query”:qb.join(“”),”viewFields”:[
        “Sharepoint_x0020_ID”,
        “Title”,
        “DivisionAsText”,
        “SectionAsText”,
        “ClassificationAsText”,
        “Employee_x0020_ID”,
        “Representation”,
        “Supervisor”,
        ]});

        if(res.count > 0){
        item = res.items[0];

        setFieldValue(“Title”,item.Title !== null ? item.Title : “not set”);
        setFieldValue(“Employee_x0020_ID”,item.Title !== null ? item.Title : “not set”);
        setFieldValue(“Division”,item.DivisionAsText !== null ? item.DivisionAsText : “not set”);
        setFieldValue(“Section”,item.SectionAsText !== null ? item.SectionAsText : “not set”);
        setFieldValue(“Classification”,item.ClassificationAsText !== null ? item.ClassificationAsText : “not set”);
        setFieldValue(“Supervisor”,item.Supervisor !== null ? item.Supervisor : “not set”);
        }
        };

      Viewing 2 posts - 1 through 2 (of 2 total)