2

I've a discussion list, say L1. I've another custom list, say L2, with fields client, support person, start date, end date. ex

client     support person      start date        end date
---------------------------------------------------------

client 1     Jack             17-May-2016    30-May-2016
client 1     John             12-May-2016    30-May-2016
client 1     Mary             01-May-2016    30-Jun-2016
client 2     Jim              17-May-2016    30-May-2016
client 2     Jane             20-May-2016    30-May-2016

my L1 has a 'client' field. I want to trigger a mail to the corresponding support person when a discussion is posted in L1. for that i'm trying to create a workflow. I'm trying to create the workflow in L1. my challenge is to retrieve the applicable support persons from L2, like SELECT support_person from L2 WHERE client= currentItem.client AND start_date =< currentItem.created AND end_date >= currentItem.created

is this possible with workflow? I'm using SharePoint online.

1

It can be done, but you would need to rely on calling the REST API from a designer workflow.

In plain words you would need to first make a call to the L2 list with the filter values. Once that is retrieved you can get the ID of the item in L2 and from there you can get the user in the L2 item.

In your workflow start by creating a new dictionary which includes two items ("Accept" and "Content-Type") both should have the following value:

application/json;odata=verbose

Next you need to make a http call towards the L2 list with the correct CAML query:

_api/web/lists(guid'D38E6516-FB4F-4FCF-9E29-4FEC9CE06D2B')/GetItems(query=@v1)?@v1={"ViewXml":"<View><Query><Where><Eq><FieldRef Name='Field you want to filter by'><Value Type='Filter type'>Actual value</Value></Eq></Where></Query><RowLimit>100</RowLimit><ViewFields><FieldRef Name='Id' /></ViewFields></View>"}

GUID is from L2.

From here you should be able to retrieve the Id of all items that matches your request.

When building the CAML request you can use the U2U builder or similar to speed things up. Also your REST call must no exceed 254 characters if it does it will fail.

You may refer to thiese links for more details - unfortunately this is an area which is very sparsly covered by Microsoft: http://mysharepointinsight.blogspot.dk/2013/05/using-sharepoint-rest-services-from.html https://sergeluca.wordpress.com/2013/04/09/calling-the-sharepoint-2013-rest-api-from-a-sharepoint-designer-workflow/ http://blog.bullseyeconsulting.com/archive/2014/08/31/conditionally-set-permissions-on-new-documents-in-sharepoint-2013-workflow.aspx

  • thanks for the detailed answer. I'm new to REST API. will learn and try your suggestions, and come back. thanks – Jack Eapen May 19 '16 at 9:34
  • If you need to help after you have tried and read a bit reach out again. – Morten K May 19 '16 at 9:57
  • Once you get a result, you can use the Get Item From Dictionary action to retrieve the values from d/results Source – Chris Odegard Jan 23 at 2:35

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.