How do I compare a SP user to a Nintex user variable in CAML?

  • 11 March 2015
  • 4 replies
  • 6 views

Badge +4

Hi all!

I have a CAML query against a SP list and am trying to grab some fields where the Author field of the list = the current User in an Nintex collection (the collection is populated by a list query that returns SP users).

 

Currently I have:

<Where>

     <Eq>

          <FieldRef Name="Author"/>

          <Value Type="Lookup">{WorkflowVariable:currCommentor}</Value>

     </Eq>

</Where>

 

I've tried value Type = User which also doesn't work.  I've also tried LookupId="True" in the fieldRef. The other bummer is that I don't know what's in that currCommentor at run time to be able to type it into the CAML editor to 'Run Now'. 

 

Am I barking up the wrong tree? Seems like this should work in theory


4 replies

Userlevel 6
Badge +16

Take a look at this post Query List using a Person field | My Learnings

Badge +4

Thanks for the post! what's being stored is actually a really gross

looking SP id something like 12df|a325.ctr (that is not a valid ID, just

displaying that it isn't username like eriley). Removing LookupId isn't

working unless I pass in the 'pretty user name' which right now I'm

hardcoding to test. Next challenge is how to get that pretty user name

from that gross SP id. I found a few articles on it using the Query User

Profile (although I don't know what profile this is reading) or doing a

webservice request, which I may not be able to do because the env I"m using

is hosted and they don't like giving out system passwords. I might end up

writing a text only version of the user name to the SP list so I can use

that for lookup sad.png

Badge +4

Alright, so you can use the set variable activity to save the person variable's display name by setting <newWorkflowVar> equals Workflow Data <user workflow variable> clicking on the elipse an selecting display name as the return type.  Now in the CAML query i can do <FieldRef Name="Author"/> <Value Type="User">{WorkflowVariable:newWorkflowVar}</Value>

Badge

I have an issue with this, because some of the people in my organisation share the same names... and so they have login names ending with numbers (ie. john.smith2). So, when comparing, 'Smith, John' can be multiple people.

Is there another way to do this?

Reply