Get User Group and step through first two found, and use the next group.

Sep 20, 2013 at 8:25 AM
I am quite new to the use of SP Services and i have an issue that i hope someone can help with.

I would like to display on the home page of a site tasks which only display depending upon that users group.


Field-Task - Field-TargetAudience
Task 1 - Group 1
Task 2 - Group 1
Task 3 - Group 2 & Group 3
Task 4 - Group 3

This would be the tasks and which group they are targeted to.

If i display the XML it returns the groups on alphabetical order and i can see there are a few groups but i would like to skip over the first site owners and site memebers groups and just apply the filters on the next group it hits.

My Code:

$(document).ready(function() {

// Get group variable
 operation: "GetGroupCollectionFromUser",
 userLoginName: $().SPServices.SPGetCurrentUser(),
 async: false,
 completefunc: function(xData, Status) {
 groupName = $(xData.responseXML).SPFilterNode("Group").attr("Name");               
  lookUp = groupName;

operation: "GetListItems",
webURL: "/sites/********/********/",
async: false,
listName: "~~~~~~",
CAMLViewFields: "<ViewFields><FieldRef Name='ID' /><FieldRef Name='Title' /><FieldRef Name='TTA' /></ViewFields>",
CAMLQuery: "<Query><Where><Eq><FieldRef Name='TTA' /><Value Type='LookupMulti'>" + lookUp + "</Value></Eq></Where></Query>",
completefunc: function (xData, Status) {
  $(xData.responseXML).SPFilterNode("z:row").each(function() {
    var aud = $(this).attr("ows_TTA").substring($(this).attr("ows_TTA").indexOf('#') + 1 );

    var listID = $(this).attr("ows_ID");
    var liHtml = "<li><a href=javascript:SP.UI.ModalDialog.ShowPopupDialog('/sites/Nestle2/ReportingTool/Lists/Triage/DispForm.aspx?ID=" + $(this).attr("ows_ID") + "');>" + $(this).attr("ows_Title") + "</a></li>";        

Thank you in advance.......
Oct 4, 2013 at 6:23 PM
Edited Oct 4, 2013 at 6:24 PM
Did you figure this out or do you still need help?