0

Team,

I have a very restricted Sharepoint environment;

  • no access to designer
  • no access to Filter webparts
  • workflows limited to (1) Approval (2) Collect Feedback (3) Collect Signatures (4) Three-state

So the only solution I think I have is javascript and client side rendering (which works ok).

Setup:

List #1 (Induction List)

Columns:

  • Name - single line of text
  • Work Instruction - Hyperlink

List #2 (Induction Status)

Columns:

  • Name - Lookup (Induction List/Name)
  • Assigned to - Person or Group (multiple selections = no)
  • Completed - Date/Time (Date only)

On the page I have two views;

View #1 - Induction List

View #2 - Induction Status

Goal:

  1. display outstanding induction activities.
  2. view completed induction activities by who is logged on.

I can accomplish goal #2 by filtering the Induction Status list by Assigned To = [me]

Goal #1 is the trick.

For example, lets say I have 3 induction activities...

  1. Get Photo ID
  2. Get laptop
  3. Setup Email

The Induction Status list may look like...

  • "Get Photo ID" "Bob" "01/01/2017"
  • "Get Laptop" "Bob" "02/01/2017"
  • "Get Photo ID" "Jane" "01/02/2017"
  • "Get Photo ID" "Bill" "01/03/2017"

When Bob views the Induction Page, I want "Induction List" to hide list items that appear against Bob in the "Induction Status" list, which in this case would be "Get Email" (in other words only show the outstanding induction activities).

Based on all the restrictions in my environment, I was thinking create an array of all the "Name" list items in "Induction Status" where "Assigned To" = "Bob" then perform a client side rendering loop of all the items in "Induction List" and hide any item that has a match in the array (or use an item array that pre-exists in Sharepoint for lists in general).

I've read Targeting specific list with Client-side rendering

But not realy clued up on building the array and running the compare or hiding for that matter.

The other thought was joining the two lists together then only display items that the logged in user does not have a completion date for.

Any assistance, would be greatly appreciated.

Regards Michael

1 Answer 1

0

copy the below code within the <html> </html> and place it in a html file. any problem you can contact me.

<html>
<body>
<input type="button" onClick="javascript:getInductionListByUsername('Bob')" value = "Test" name="Test" >
</body>

<script>
function getInductionListByUsername(username)
{


    var inductionList = ["Get Photo ID", "Get Laptop", "Setup Email"];
    var myArray = [
       ["Get Photo ID", "Bob"],
       ["Get Laptop", "Bob"],
       ["Get Photo ID", "Jane"],
       ["Get Photo ID", "Bill"]     
   ];

   for (var i = 0; i < myArray.length; i++) {

       if (myArray[i][1] == username )  {
          //induction matching Bob
          alert("matched:" + myArray[i][0] + " " + myArray[i][1]);             
       } 
       else 
       {
          //induction not matching Bob
      alert("not matched:" + myArray[i][0] + " " + myArray[i][1]);
       } //end if

   }//end for

} //end function

</script>

</hmtl>

Cheers.

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.