0

we are $().SPServices.SPCascadeDropdowns for cascading. Suddenly it stopped working. now I want to use another option of using SPServices with CAML query to display the projects based on Employee selected. Something like this

 $().SPServices({
                     operation: "GetListItems",
                     async: false,
                     listName: "Project Allocation",                    
                     CAMLRowLimit: 1,
                     CAMLQuery: "<Query><Where><Eq><FieldRef Name='Employee' /><Value Type='Lookup'>" + thisUserAccount  + "</Value></Eq></Where></Query>",   
                     CAMLViewFields:"<ViewFields><FieldRef Name='Project' /></ViewFields>"  ,
                     completefunc:null,
                     debug:true
                     });

but I am not able to filter.I am new to SPServices. please guide me for this

1

Your CAMLQuery: "<Where><Eq><FieldRef Name='Employee' /><Value Type='Lookup'>" + thisUserAccount + "</Value></Eq></Where>"

should have "<Query>" tags:

CAMLQuery: "<Query><Where><Eq><FieldRef Name='Employee' /><Value Type='Lookup'>" + thisUserAccount  + "</Value></Eq></Where></Query>"
  • thanks for that. But I am not able to do any filtering. All list items get populated. – SharePointMan Mar 27 '14 at 10:24
  • How are you using it? since your completefunc is null... – Robert Lindgren Mar 27 '14 at 10:27
  • as I said I am new to it.i don't know how to do it..i want to filter projects based on employee selected. – SharePointMan Mar 27 '14 at 10:30
  • See here for basic usage, make that work first then try with lookups etc. sharepoint.stackexchange.com/questions/39190/… – Robert Lindgren Mar 27 '14 at 10:32
0

If the cascade stopped working after a SharePoint upgrade, check out this blog post: http://sympmarc.com/2014/01/23/office-365-update-changes-display-name-on-required-fields/

I would also suggest to try out this solution for Cascading Selects (disclaimer: I am the author).

  • I have already seen all those posts. Cascading fails because of List view threshold Exceeded. – SharePointMan Mar 29 '14 at 4:24
  • I see. I would recommend to include this key info in the question, because in this case the issue is actually with the lookup itself, not with the cascading. You might want to read this: sympmarc.com/2014/02/18/… – Christophe Mar 29 '14 at 4:42
  • thnks Christophe.I read that article too.actually I read almost all articles from net related to SpServices. – SharePointMan Mar 29 '14 at 4:50
0

Try adding LookupId='TRUE' to your FieldRef. (Also make sure that Employee is the internal name of your field.)

<Query><Where><Eq><FieldRef Name='Employee' LookupId='TRUE'/><Value Type='Lookup'>" + thisUserAccount  + "</Value></Eq></Where></Query>

Also, an employee's userID varies depending on what site you're in. It's stored in a hidden list in each site.

userID = $().SPServices.SPGetCurrentUser({
    fieldName: "ID",
    fieldNames: {},
    debug: false
});

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.