0

I want to show the user only his tasks on specific list, and show him the option to approve and reject from that view.

In order to get his tasks I have used the below code:

        var traineePromise = $().SPServices.SPGetListItemsJson({
        webURL: _spPageContextInfo.webAbsoluteUrl,
        CAMLQuery: "<Query><Where>\
                 <And>\
                     "+ workflowname + "\
                     <Or>\
                      <Eq><FieldRef Name='AssignedTo'/><Value Type='Integer'>"+ _spPageContextInfo.userId + "</Value></Eq>\
                      <Membership Type='CurrentUserGroups'><FieldRef Name='AssignedTo'/></Membership>\
                     </Or>\
                 </And>\
             </Where></Query>",
        listName: "Workflow Tasks"
    });

    $.when(traineePromise).done(function () {
     ...
       })

Unfortunately, it's not working

  • 1
    What is the value of workflowname? You say it's not working.. What is not working exactly? Are you getting errors? – Abbas Mar 21 '18 at 13:48
  • You can replace AssignedTo portion with <FieldRef Name='AssignedTo'/><Value Type='Integer'><UserID/></Value> - This is the equivalent of using the [Me] token in views msdn.microsoft.com/en-us/library/office/aa544234.aspx – theChrisKent Mar 21 '18 at 14:16
0

you can also achieve it by using REST API

/_api/web/lists/getbytitle('workflowname ')/items?$filter=Approver eq ‘username'

  • are you sure I can use workflowname inside "getbytitle"? – Eyal Segal Mar 21 '18 at 13:39
  • yes... look at this codeproject.com/Articles/1134731/… – Melad Batta Mar 21 '18 at 13:42
  • 'workflowname' above should be the name of the tasks list. Filtering on the workflow would be done in the $filter portion – theChrisKent Mar 21 '18 at 14:17
  • To be hones, I don't succeed :( – Eyal Segal Mar 22 '18 at 12:13

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.