Get Items by Query

by bsieloff » Thu Aug 18, 2016 8:46 pm


I have a question on how to use 'get item by query'

I would like to get a field from a list.

I know the ID of the row
I know the List Name
I need the data from the field 'Assigned to'

I would like to use this field to set permissions on a task item.

Can you help by typing out how the query would actually look from the picture below:
itembyqueryQuestion.png (84.86 KiB) Viewed 306 times

Here is the default query, but I was not sure how to modify it correctly;

<View><Query><Where><Eq><FieldRef Name="Title" /><Value Type="Text">Test</Value></Eq></Where></Query><ViewFields><FieldRef Name="Title" /></ViewFields></View>

Also could you give me an example of how the variable is saved in the dictionary and how to retrieve the information to use in the rest of the workflow.

Thank you
Posts: 8
Joined: Fri Jul 08, 2016 8:48 pm

by bsieloff » Fri Aug 19, 2016 2:10 am

wow... I've actually got something that give results. Good day to learn CAML query

Here is the part of my workflow that sets the permissions on the task item giving the 'assigned to' person contribute rights and everyone one else only view.

settingpermissions.jpg (109.5 KiB) Viewed 303 times

Here is the CAML query that I am using
Code: Select all
         <FieldRef Name='ID' />
         <Value Type='Counter'>[%Variable:LoopCounter%]</Value>
   <FieldRef Name='AssignedTo' />

Was running correctly the first time I ran the workflow. First person it found was 399;#Mickey Mouse
then continued through the loop six more times. I stopped the workflow for two reasons.

1) it was very slow going through the loop. Is there a reason for this? Is it because I am only using the demo version of Plumsail action pack right now? Do you see issues in the loop above that could fix the slowness?
2) I had not finished all the permission settings I wanted

After getting the permissions set correctly in the workflow, I re-ran the workflow and it stopped with an error stating that it could not resolve the username : 399

Why could it find the user 399 the first time I ran the workflow but not the second or third time I tried running the workflow?

Last question: Is there a way to tell Plumsail to ignore the error on the lookup and continue through the loop until the end?

Thanks for your help

update: It's actually getting stuck on the last step I added which was to grant the 'Assigned To' User contribute rights to list item.

I send an email to myself to check what the assigned to field is equal to. In the first case it is equal to : 399;#Mickey Mouse

Perhaps it's my variable?

variableassignto.jpg (174.61 KiB) Viewed 303 times


The workflow was actually trying to resolve 399 as a user name.

I had to separate 399;# from 399;#Mickey Mouse

Therefore I wrote a step with a regex replacement

My regex statement was: ^[^#]*# and the replacement was nothing (space)

I then was able to set the permissions to the new variable that held the result of the regex result of ^[^#]*#
Posts: 8
Joined: Fri Jul 08, 2016 8:48 pm

Return to Workflow Actions Pack for Office 365