0

I'm trying to use the LookupSPListItemId activity in a SharePoint 2013 workflow in Visual Studio. The condition I'm trying to set is when a person field equals a specific person.

The problem is I'm not sure what the format of the person parameter should be (which needs to be a string according to Visual Studio)

I have tried the user's ID (i.e. 2 as a string).
I have tried the user's login ID (i.e. domain\username)
I have tried the user's name (i.e. Joe Bloggs)
I have tried the user's claims login

When debugging with Visual Studio I can see in the workflow debugger output window an error occurs, presumably because I'm not passing in the correct parameter in the correct format.

This is the error I am seeing:

Retrying last request. Next attempt scheduled after 02/01/2015 17:18. Details of last request: HTTP BadRequest to http://server/sites/sc3/leave/_vti_bin/client.svc/web/lists/getbyid(guid'ebac8268-e9be-4cde-9573-ae242333f5bd')/Items?%24filter=PersonId+eq+'2'&%24select=ID%2CID Correlation Id: e649d849-9499-a1bc-9412-93930eb5f845 Instance Id: 98f7ec21-4381-4e9d-be20-1c094e02fff6

4
  • Why can't you use the users email? I believe the email will be unique. Commented Jan 2, 2015 at 17:21
  • @AmalHashim are you sure I am able to use an email address as input into a filter for a Person field?
    – Submits
    Commented Jan 2, 2015 at 17:25
  • Submits: I was just throwing out ideas. I haven't got chance to use LookupSPListItemId so far. From your error message, it seems the PersonId you are comparing is with 2. Also the request is not valid because at the end there is an extra %2CID. Try to put the URL into browser and check if it works. Commented Jan 2, 2015 at 17:36
  • Amal, thanks for the tip re putting the URL into a browser. The response was clearly telling me the field name was wrong.
    – Submits
    Commented Jan 2, 2015 at 17:54

1 Answer 1

0

For the benefit of others, this is what I was seeing in the response XML:

<m:error xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
<m:code>-2147024809, System.ArgumentException</m:code>
<m:message xml:lang="en-US">
Column 'PersonId' does not exist. It may have been deleted by another user. /sites/sc3/leave/Lists/Leave
</m:message>
</m:error>

It seems when using the LookupSPListItemId activity and selecting a field of type Person/Group to filter on, Visual Studio decided to put "Id" at the end of the column name.

I.e. my Person/Group column name was "Person", but Visual Studio was setting it to "PersonId". I renamed it back to "Person" and the workflow no longer was throwing errors. I mark this down to another of many quirks of SharePoint/Visual Studio.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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