CAML query not giving result when inserting workflow reference


Badge +8

I'm trying to query a list in another site using CAML query, however I'm not getting a result if I'm inserting references. while on the other hand when I enter the value manually it gives the result. anyone having this issue? The reference value is there and correct. I run the same caml query with value entered manually and it works fine. This is my CAML query: 

<Query>

  <Lists>

    <List ID="{9D234801-4B45-4283-9F7C-6348BE9E2D55}" />

  </Lists>

  <ViewFields>

    <FieldRef Name="LetterRefNo" />

  </ViewFields>

  <Where>

    <Eq>

      <FieldRef Name="ID"  />

      <Value Type="Counter">{WorkflowVariable:test}</Value>

    </Eq>

  </Where>

</Query>

I'm trying to retrieve the LetterRefNo where ID is equal to {WorkflowVariable:test} I have tried setting the value type to Text or Counter but I got the same result...


3 replies

Badge +7

How are you running this query - are you using the "run" command of the workflow designer? Within the designer variables are not replaced by the actual values ... they are only replaced at runtime ...

What you could try is to create the CAML query using a "build string" action and then have a look at the actual value using the verbose logging. Maybe you're CAML isn't formed the way you assume it to be.

Badge +8

Im aware of that. To test it I run the workflow. hmmmm I found an alternative solution to do what I was hoping to achieve but I'm still trying to figure out why that didnt work in the first place. I have tried builstring action as well  and the result was the same

Badge +7

Hi,

Try the variable as a number and also change the <List ID="{9D234801-4B45-4283-9F7C-6348BE9E2D55}" /> to <List Title="your list title" />.

Jan

Reply