I have a workflow currently that will send an email when an item is completed under certain conditions. My issue is that multiple items may fall under one project title, and I would like for only one email to be sent when all the items are completed and for the email to include the data on all the items that were completed. I have included the setup I am using currently for sending an email with completion of each item individually in testing for SharePoint 2007, but I also have this in SharePoint Online as we are getting ready to switch over soon. Any assistance with how I can go about doing this would be great. Thanks!
Hi Ken,
Are these documents related? If so, are they always created together (possible use of a document set?). You’ll have much better luck in SPO instead of SharePoint 2007 because of increased flexibility from SharePoint 2013 workflows. These workflows will allow you execute a query and get all the items with the same title and then loop through them to check their statuses.
Thanks,
Hi Ken,
You may have better luck using Chrome. IE is going to return this as an XML feed. If you open this up in Chrome, you’ll see the XML Load.
I would start with that URL. When you see XML show up, move to the next portion..
/_api/web/lists/GetByTitle(‘Tasks’)
And see if XML shows up. If yes, try and grab some items like so…
/_api/web/lists/GetByTItle(‘Tasks’)/items
and work your way through the url until you can start filtering the items.
I grabbed one of our development team who knows some XML to try and help me figure out what the heck I am missing here. We were unable to determine the issue, but we started trying to back-trace the URL to see maybe where it is failing out. We got to https://mycompanyname.sharepoint.com/_api/web/Lists/ and it is pulling up this page which is totally confusing me as it looks like an RSS feeds page and I am not sure what it is pointing to. Not sure if this might help determine what I am missing here, but I am hoping so. If not I think I may just need to throw my hands up on this one for a while. Thanks again Beau, I really do appreciate you trying to help out.
I set up the workflow but I am running into a couple of issues. In the 1st stage I have a call to Variable: url that for some reason is not working. I haven’t put the %% in by hand and used the lookup to place it into the call but it is still giving an error. Secondly, in the Workflow Settings I only have the option to kick this off manually and I am not sure why the option is not there to kick this off when an item is changed. I am including screenshots of this as well as my overall setup and the variable for the Email from the previous comments above to make sure I am setting it up correctly.
Hi Ken, This may be a weird question but did you update the URL to your url? I see it is currently mapped to the blog post example of SP2013. You’ll just want to concat your string for your environment. ie. using the fx (function) button and build the string you need. “https://yoursharepointonlineenvironment.com/_api/web….”
After slapping myself in the head, I updated the URL to our environment. However, when I click Check for Error’s it’s still coming up as an error. The string I built is as follows: https://myenvironment.sharepoint.com/_api/web/lists/getbytitle('Tasks‘)/items?$filter=[%Test Task List 1:Task Name%] I used the base address for our SharePoint, but do I need to specify the Site Page I am on as well?
You need to specify your filter. For example, if it’s the task name. You’ll want to use $filter=Title eq ‘[%Test Task List 1:Task Name%]’ Where “Title” is equal to the internal column name of the Task Name. Here is a link on how this works. https://social.technet.microsoft.com/wiki/contents/articles/35796.sharepoint-2013-using-rest-api-for-selecting-filtering-sorting-and-pagination-in-sharepoint-list.aspx#Filtering_items You can test these out by pasting your URLs in the browser and hitting enter. They will execute and you should either get an error back or XML with your data (if it succeeded).
Ok, thanks! I’ll take a look at this link tomorrow to confirm.
I tried entering as follows: …/_api/web/lists/getbytitle(‘Tasks’)/items?$filter=Task Name eq ‘[%Test Task List 1:Task Name%]’ but I am getting a 404 error. Not sure what I am doing wrong. If I understood correctly the “Title” was supposed to be the column name, which is “Task Name”.
Hey Ken,
Here is a decent post. https://weblogs.asp.net/ricardoperes/looping-through-list-items-in-sharepoint-2013 The key pieces are the $filter (you’ll want to filter by project title).
Great! Thanks a million, Beau!
One more question, just to make sure I am understanding this correctly. I am in the loop portion of creating the workflow now. When do I set up the portion to include this into an email that will include all the results I need to send out? After the loop portion is done? I see there is an update to the log here, but I am unsure exactly where to put in the email step and what references to include to show the Project Title, all the associated ticket numbers, and the date completed (today’s date). Thanks!
Hi Ken, You are correct. After the loop. You’ll likely want to keep a running log of each portion into a string variable and use that variable in the email. I’m not sure if there are limits on the maximum length of strings… but I have been successful doing this in the past.
Ok, good. I am following you in concept I think, execution might be another issue. I’ll work on this over the next couple of days between my other tasks and if I run into any issues I’ll post here along with screenshots of what I have created. Thanks again Beau, I really appreciate your help!
Thanks Beau! Yes, the list items are created individually with the same Title but different associated ticket numbers. The query and loop sounds like exactly what I am looking for. Do you have any recommendations on where I can find a good tutorial for this for SPO?