How to use the ‘Call Web Service’ Action in a SharePoint Workflow

Laura Rogers

Laura demonstrates how to use the call web service action in SharePoint Designer 2013 workflows.

[00:00:01] Hello, welcome everyone. I’m Laura Rogers and this is SharePoint Power Hour, my weekly show where I talk about a lot of different SharePoint topics every Wednesday at 11:00 central. We go over 100 different things we’ve been doing this for a couple of years now. And today’s topic is actually going to be SharePoint designer workflows working with web services and doing web service calls so it’s going to be kind of nitty gritty and technical and let’s see a little bit of information before we get started. This is mostly going to be a demo. But we have a conversation always going on over in my Slack channel which there is a link to the description of this YouTube video. There’s going to be a link to be able to fill out the form to join it if you haven’t joined it. And once you are a member and I’ve sent you an invite to slack it’s and we have a little Power Hour, hashtag power our channel in there and that’s where we have all of our conversation going on. [1:08.4]

[00:01:10] So let me go ahead and get my link shared in there. [7.3]

[00:01:17] Let’s see do that. [1.8]

[00:01:25] There you go. All right. Web services. I’ll put it in here too. So if you guys are watching and chat now you have a link to where the live show is. I did go ahead and put a 30 second delay on the streaming of this video because it will help with the performance as it goes out to you guys. So as you ask questions and things like that they’ll be a 30 second delay from you know what what I’m doing. All right so let’s see everybody come say hello in the chat window. And keep in mind that the whole reason that I do this live is that I love to get your guys’ interaction and ask you questions and get sort of feedback as I’m going and it makes it a lot of fun it makes it. You know it’s a community effort. [51.2]

[00:02:16] So let me go ahead and tweet out and see we’re live. I started just streaming straight to YouTube directly from my computer instead of doing a Google Hangout. So I just now have a link. We’ll figure it all out. You know make it smoother sooner. This is going to be mostly a demo. You know a lot of fun. [27.6]

[00:02:44] All right. Here we go tweet. OK. [4.6]

[00:02:52] All right so workflows and Web services I did write a blog post yesterday. [4.2]

[00:02:57] If you go to where I talked about what we’re going over and power are today just the overview and then basically it’s got some reference materials in it to understand just sort of digging into these Web services because once you start digging into web services and your SharePoint designer workflows it’s pretty technical, so it’s bordering on dev. And you know I’m not a developer I’m not a programmer I don’t know what Jason is or what rest is but I figure it out as I go. So that’s kind of what we’re going to be doing here. So again welcome everybody come say hi. [39.0]

[00:03:36] And I guess you all can see me and we’re streaming live when I’m streaming live directly from my computer. It doesn’t let me do the Google hang out with other people in it like Corey So that’s maybe maybe the Google Hangouts will get better over time we’ll see. All right. So I’m going to go ahead and switch over to my screen sharing and go to my. [24.1]

[00:04:01] There we go. [11.6]

[00:04:13] This is software that lets me stream live while I’m talking. [3.6]

[00:04:18] OK. Actually [2.7]

[00:04:21] OK. So here is just a generic SharePoint site which is going to be this is going to be the one that we’re going to delve into. Our looping workflows with. Now there are a couple of different sort of fundamentals to understand in here. Kind of like the this is sort of the I wrote my blog post or we’re going to talk about as the structure today. But one of the fundamentals is going to be understanding this sort of call web service just the action itself and what we’re really going to be eliciting or getting from it. And then another one is going to be there we’re going to talk about sort of what structure that it’s going to expect and different ways to make it more efficient. And so that’s going to be really important especially when a lot of times we use web service calls you know to be able to look through things in a list and SharePoint and sometimes I’ll just use them if. If you’re dealing with a really large list that it’s workflows kind of get awkward when you’re trying to go you know find maybe some specific information and a large list or even if you want to just be able to go get one item. That’s just a small handful of items from a large list. Then we’ll use the web service so there are a couple of different things you need to have in place. First of all you’re always going to have to have this concept of a dictionary because a dictionary for that tapping into the web service is going to send information about just the fact that it’s using J song. [1:33.9]

[00:05:55] So it’s just a little bit of sort of structural information that it needs. [5.2]

[00:06:00] So let me go ahead and look SharePoint designer and do a new list workflow. [7.6]

[00:06:08] I’m just going to do a list workflow actually. I’m going to do a workflow that has a site workflow because a lot of times when I’m looping through items in a list or a library it doesn’t necessarily need to be based on something happening on a specific item in a list or library it just needs to be running and maybe it needs to run an interval or something like that. So that’s what I’m going to do is I do a lot of the times with these looping ones. And so that’s what I going to do in this case is I’m going to make it so it’s it’s a site workflow. [32.5]

[00:06:40] So it’s not specific to any list or library test web services and then click OK. All right. [11.8]

[00:06:55] And you guys let me know in the chat window. You’ve done these before. And do you have you delved into them. Have you had issues with them and things like that. I did write a previous blog post about it but it actually learned a lot since then since I wrote that post. I’m not going to be referencing that particular post that much but I do want to do want to point out that I did write about it. I did write a blog post about it kind of when it was fairly new technology. All right. So we’ll start out with the dictionary now. I actually have to have another workflow that I’ve created just kind of on another screen so I can look at things or copy and paste things. So I’m going to do build a dictionary like this. And what I have to do in the dictionary is really just two things and it’s going to be except in a content type. [53.4]

[00:07:49] And don’t ask me what any of this means because I don’t know except those of you who are dhows in this chat window know exactly what this means and what it’s for. [17.4]

[00:08:07] Feel free to chime in. [0.8]

[00:08:10] But this is just the same verbage that I do and every single one of these that I need to have. All right so then we’re going to call a web service and this is where we need to kind of like think about what our what our syntax is going to be and what exactly we want to loop through. And so let me go grab one from my other workflow. [21.8]

[00:08:32] Call the web service again that’s all right. [12.3]

[00:08:51] Like that. Now let’s go open up Notepad. Actually yeah let’s just do that. And look at some of this information. So this is your current site right here at the beginning. So it’s going to be the site. Now this get my I.D. you can get by ID or get by title but this is the list that you want to get information from or loop through. And so that’s going to be. You can do get by title and you just put the title in quotes. A lot of times if I have one that’s got a title with it you know where maybe you might have different ones that have similar titles or something like that. I don’t want to get confused. So in this case I just shoot the guy and you can get the good if you are not sure what to do it is like this one. I’ll go get it. Customer contacts is going to be my list. And when I get to list settings this is the good right here. And then I actually have a your all encode decode page that I like to do. To be able to get. [1:22.5]

[00:10:18] We go to be able to figure out what that is without all the weird characters in it. So I just paste that in there and decode it. [6.8]

[00:10:25] So now I have just a good old number that I can use and copy that. And so now I have my good. All right. So let’s go back to the notepad. So this is going to be the good of the list. I want to loop through which is contacts and then I can actually do a filter here so this will make it much more efficient so I can just I can just delete this part and just have Slash items. And so when this web service query gets queried it’s just going to pull back all the items in the list. And that’s what I did in a blog post that I wrote. But you can actually filter it here so that way I can narrow it down so I can pull back. Fewer so I don’t have to go and do filtering and loop through in you know figure out how to narrow it down later on once I’ve already gotten all the and all the data that makes sense. So I can just filter it later. [1:00.6]

[00:11:26] All right let’s go let’s go see what the state is going to look like. So I’m going to say what do we want to filter. For my customer contacts I’ll say maybe I want to get all the customers that have company equals Contoso so and I can even do a couple of different filters too so I could say no company equals control. So status is equal to active or something like that. Let’s just do one for now. So I need to know for company what is that feel called. Is it called Company to double check. So when I hover over this I can see in the very bottom in the little status bar in my browser it says Field equals company and that’s just my quick way of double checking that that’s the name of the field. [51.4]

[00:12:17] So I can say filter where company equals and I can just type control. So right here so I’m just going to type it for now and then maybe we can change it later just to kind of you know we’re kind of we’re work we’ll work our way up to more complexity so filter company equals control so we don’t have to put it in little quotes and take this whole thing. And. [31.1]

[00:12:51] Go over here. Call this web service and paste it in here and then for the current site. I need to have I can use the little workflow context current site URL. Here we go and if it was looping through like the current list I could do like you know current list. [21.0]

[00:13:13] Let’s see if I was in a list it it would have options for like what’s the list name or the list would do so. But I’m doing a site workflow or at some to go through all those and pull back everything were company is equal to control so and I’m getting it. So I’m doing the CTP get. [20.5]

[00:13:34] All right so what about all this other stuff. So the way that needs to be set up is request headers. [6.3]

[00:13:41] I’m actually going to up the properties of this thing. Request headers to be variable dictionary and then response content is going to be like a J-Sont thing that don’t create. [13.6]

[00:13:57] So request headers is going to be that dictionary that I use. [4.1]

[00:14:01] And that’s like header just basic sort of information that it’s providing that as it does the query just the fact that it’s J-Sont and it’s got that weird J-Sont string that we you know I’m not a dev So that’s that’s a good thing about some of this is that I’m sort of translating some of this stuff stuff that it’s important that you do need to kind of know syntaxes and things but also things that that are standard that you can put in place and not have to necessarily worry about what it means and then I just it just works. So then response content needs to be a variable and then response status code. [39.0]

[00:14:40] OK. See. [2.5]

[00:14:47] See response status code already has this response code in it. [3.5]

[00:14:51] And then this other one that’s important then it can only get to you from the properties is the one call of C response content. [8.0]

[00:15:07] Create a new variable ASC-P list Jaison to it and that’s a dictionary. OK that’s where it’s going to give me back the information. [11.5]

[00:15:21] So this is where I’m going to get all the data that I need. All right so then what is all this though. So what does that do. What does that give me when we do we’ll just test this. We’ll go to the end of the work for now. Once I get this information I can’t do a lot of history it’s a lot of times and workflows are like just using log the history list so that it lets me just kind of see what’s going on in there. So I need to be able to see what’s in here because that helps me kind of understand all this and that was one of those things where I would read blog posts and kind of just put the blog posts had in it. But I don’t really understand why or what it was. Jim says Can it go across sites or is only current and sub-sites it can go across. It can go across sites and supposedly it can grow across site collections but there’s extra stuff you need to do to be able to go across site collections because but by default it’s really easy just it just works across just any within a site collection. All right. So let’s see I can’t look at the history list because it’s going to dump back a whole bunch like a whole big long string of all kinds of stuff so I can’t log in a history list because it will give me an error because it’s more than 200 witchcraft characters. [1:17.5]

[00:16:38] So what happens is I’m going to go ahead and just create just a custom list just so I can have this big text field just so I can dump this information in and see what the heck it’s giving me. [12.6]

[00:16:52] So we’re kind of dissecting this thing so instead of just kind of spitting out what I’ve written in my blog post I’m going to go ahead and we’re dissecting this and showing you how it works as we go. [10.5]

[00:17:04] All right. I’m going to say yes. [1.4]

[00:17:08] And make it multiple lines of text and plain text is fine. And then for that title field I’m just going to make it default to just something just so that it will give me an error. Or I can just make it not required either one. I just need to be able to dump stuff into this stuff field in my test list. All right so now let’s go refresh this because every time I change something in SharePoint I need to refresh SharePoint designer so it recognises what I changed and then we’ll go of C and look you know look at what it gives me back. [33.3]

[00:17:46] OK and then I’ll go create create an item in my test list. [8.3]

[00:17:57] My task list is NOT show up because it didn’t wait long enough for it to finish refreshing. Come on to your point. You can do it. [7.1]

[00:18:11] I’m just going to go look over here and see there’s no reason for this thing to be slow. Yes so the cool thing about this concept of web services that we can go across within a site collection we can go find some specific thing in any list or we can go find a set of things in a list and then be able to iterate through those and then do something with and loop through and do something with all those items or take all those items and put them into an email or delete them or you know whatever you want to do with them. So I’m going to go see if my list is showing here now. [35.9]

[00:18:47] There we go. So I’m just going to say X and then set my field stuff to say whatever the heck is in this J-son thing and publish. [14.5]

[00:19:03] Some kind of going through this fast hopefully if you’re watching the recording later you can just pause and rewind and stuff like that. But I’m already 20 almost 20 minutes in. I got on I’ve got a ton to show you in here. Do you guys did I make it clear. Does it make sense to you guys kind of why we would use web services. If you look at the reference. Well while we’re waiting for that thing to publish you know it’s taken so long. If you look at the reference in here let’s go click on a couple of these. It’s got to where we can go do things with the whole list itself. We can do things like get all the names of all the lists libraries and the like the titles of them and where we can go do things with the eye and so what we’re doing right now is we’re doing things with the item. So I did get by the get by Gould when I did mine. But like I said you can do get by title and do things with all the items and then these references have a lot of information. [1:06.8]

[00:20:10] And that’s going to help you put together that that web service query that I showed you. And again I’m not a devil don’t know what a lot of this means but I understand enough to be able to just kind of go look at what the syntax is that I know that I’ve gotten to work and kind of go look at what they have in here. [19.4]

[00:20:31] This one is going to be useful because it’s got there are things you can do with lists. There’s also look see some other web services are going to be like site users site groups and going into a specific library doing things with specific files. So this is where you can do things that are really useful that you can do within normal with just normal workflow actions. So my workflow still publishing sale get a couple more people and you are requesting to access it. Well yeah. I’ve got about 50 people all in a list of people that have requested to join this and and hadn’t joined so sometimes I’ll go reast it send the invitation but a lot of the times I think peoples email servers are blocking it. [51.0]

[00:21:23] I have never seen a workflow take this long to publish. That’s awesome. [6.6]

[00:21:32] So again so what we’re doing in this example is we’re going to this we’re going to the list where we’re getting all the information from the list. But you can get information from a list by like the fields in the list. That’s interesting. So what if I want to just go do something where I go get. What are all the fields in this list this list and are all the list on my site or what if I want to go obtain You know and see what all the users are who they all are groups. The groups thing seems really useful because sometimes people need to be able to just quickly see what those are. Of course there’s now the box part for that. But that’s going to be really useful maybe for more custom solutions. And then this would be able to be able to go get a particular folder. In this case it’s calling a library a folder. And in this case you can go get specific files out of here so. But what I’m doing is just list items. [1:02.4]

[00:22:37] All right. Published finally. All right. So how do we run a site workflow. We go to site contents and we go to a site workflows. [9.6]

[00:22:50] So all the time. Well I do a lot of times with these workflows that loop is I’ll just maybe haven’t run and loop and then run every few hours or something like if I need to get a list of all the tasks that are overdue and send an overdue reminder that’s where you could go through that and and go just get that whole list of tasks and then have the work flow loop you know once a day and just pause and then loop again and be able to go get all that information is something useful to you guys. This sounds like it’s stuff that you want to be able to do. So sharing points of view. [38.2]

[00:23:31] There are. [1.2]

[00:23:32] OK so an example that I’m doing that I’ve done before is looping through a list of tasks and going through a list of tasks looking for tasks that are overdue and putting together a list or every task and being able to send that in an email or one thing that I do just for myself with my own company is every Monday morning I have my time she which is SharePoint lists that I fill out and I want to be able to send each customer the list of time sheet items that I’ve logged for their projects. So I look it ran away. So it ran so. So it loops so I just kick it off and it runs on Monday and then it put it all in an email together and it sends my customer a nice little neat e-mail with a little table and it listing all the time that i logged that week for their projects. So those are a couple of examples. Let’s do my little of my little test list. Ok cool. And go to my item and see what’s what we have in here so let’s go grab all this and just copy it and go to notepad plus plus and that’s when I was doing that. That’s a Web service. Let’s go do another one. I wasn’t scary with some of that stuff. All right. Now for language I can change this to J-Son and that way it kind of puts it in a little format for me sort of. All right. Now what do we have here we have D colon results. [1:39.5]

[00:25:12] I can start sort of splitting things off for us these little curly brackets. And then I have this metadata thing. [6.5]

[00:25:19] And then I have just some information about my list and I’m looking for these little curly brackets to be able to figure out kind of where I can divide this. All right so it looks like I’ve got information about the list itself like content type whether it’s got a document from Mission policy things like that. And then I’ve got two. Fields and we’ll see where my items. [33.2]

[00:25:55] Here we go. Here we go. So here are. Some items that I have in here. Through my. Actually those are my columns. And here are some. So this is an item. Don’t worry this is all going to make sense. [15.7]

[00:26:14] Job title Engineer cell phone bill, etc. This is all the information about one particular item in my list right here. So the way Jason is structured is I need to know. It’s sort of like a subtotals table inside of it’s like sort of got sub-lists inside of it. So like this D is like the root and then results is like a sub table. And then I have all this information about all my results and then I have like each result in here. [32.3]

[00:26:47] So what I’m going to do is I’m going to use this D and this results thing in my workflow and I’ll show you more and I’ll show you a different web service that’s not a SharePoint web service to kind of show you another example of how they structure this J-son and what I did is I just googled what is Jason and I just and then I realised that that’s kind of how and how they have it structured into like these little sort of brackets determined sort of little sub tables inside of here. So it’s all good. All right. So I’m going to go to my workflow and I want to go get particular like set of information I’ll delete this thing. I want to go get a set of information from this list. [41.5]

[00:27:29] I want to go get those items some to go get. This is another one of those. It’s related to the dictionary. So I say What am I getting and from what dictionary am I getting it. So I’m going to get. And so you might have seen if you’ve written if you read blog posts about how to go get you know SharePoint web service information it’ll always say get the slush results so if you ever want to know what the heck the slush results is that’s where it comes from that’s sort of the way it’s structured in the J-son. So going out put that out to this list this at a dictionary. [40.7]

[00:28:11] And then I want to this is where you can decide what you’re going to do. So what would I do with my results next. So it’s going to give each results an index number like. Like for example the first item that I come to it’s go to my customer contacts. It’s going to go get all the other customers where company is equal to Contoso. And then it’s going to give them an index like one to three were actually I think it’s going to be 0 1 2. So as it iterates through them it’s going to go 0 1 2 and it’s going to go get the information about each thing. All right so let’s go before we start looping through things. Let’s go just get the information about one specific thing and here. All right. So how do you structure that so I go get. So it’s just getting all my results. [55.8]

[00:29:07] But let’s go look at that. [4.1]

[00:29:13] And I’m going to do title from you. [9.9]

[00:29:23] This is so I’m going to do title. So title is going to be just whatever that generic title feel every single list and SharePoint has a title field so you can’t go wrong with that. So then I also had another one called company or I already know I filtered them all by that company called control so that I can go get another one like e-mail can do that. So let’s see what I’ve got. Email, I got status. You can see what the email field is actually called I need to make sure I have that exact field name so field equals email I can see that in my status far down the very bottom of the screen so I’ll go get e-mail. All. [39.6]

[00:30:03] Right. Copy that and spitting it out to a variable. [4.7]

[00:30:13] So this is going to go find the first result zero and it’s going to spit it out to be and this one is going to be like my e-mail and the string in my title is a string. OK. Now we can log what its doing so log title in and just kind of tell me what the heck is in these variables that it’s getting my title and e-mail. [32.7]

[00:30:49] My email. So I’m just going in getting to particular. [6.1]

[00:30:55] Like from the very first item zero that it comes across it’s going to get the title and e-mail from that item and it’s going to spit it out in a log. All right. [9.2]

[00:31:09] You guys are very quiet. [1.1]

[00:31:17] Yes you’re right. Five 11:7 changing the language setting to J-son does help a little bit. I don’t know why this workflows taken so long to publish today so let’s go look at what it’s going to look at the J-son again now what it’s going to do is it’s going to go find item zero which is going to be the first thing that comes across and it’s going to. See it’s going to have a where whereas it it’s hard it’s really hard to decipher the stuff when you’re just looking at the raw code but it’s going it is going to have like a way that it numbers them all when it returns them. So trust me it is it’s like this little number in parentheses is going to be the one that goes and gets. Now when we start looping through things and I’ll just start talking about that before I go any further when we’re going to start looping through things we don’t want to just necessarily go get one thing. We want to maybe go get a few go get all the ones that have company is equal to toso So then we would go and we’d have to increment that number up this little index number. Right. So let’s go back to our site and we’ll go. [1:22.9]

[00:32:40] We’re going to go run our workflow again just manually kick it off because we’re testing. [7.3]

[00:32:53] I don’t think the column names are set. Case sensitive No. [2.7]

[00:33:01] And please work this time. OK so it’s running let’s go see what it’s doing. [7.3]

[00:33:11] Write it suspended you looking up a value using a key is not supported or an on an instance. OK that’s fine. Looking up a value using a key. All right what does that mean. [12.4]

[00:33:25] Scusi the results. Oh that’s See that’s what I did I use the wrong. [12.5]

[00:33:41] So this is getting the whole list. And this is going to get one specific thing. And I was getting it from the wrong specific thing. See this is just getting everything. And then this is yeah. So I was just looking at the wrong dictionary. And in the meantime while that’s publishing I’ll go pull up that other blog post that I wrote on looping through and point out a couple of things. [22.5]

[00:34:13] All right so I wrote this down. We’re And I tell you how to do this little except in content type thing in here. And then this is where I show you how to get all the items but then I showed you in the demo just now how you can do that little filter thing and add put the filter right in here and then I tell you how to get the goo it and what to put when you’re getting the items from the dictionary the results. But now you’ve seen kind of what that the results looks like like the raw code snaking can’t understand what it’s doing. And then if you want to be able to loop through the things in the data set that it returns that’s when we’re going to start doing the count items so we haven’t done that part yet. And so you want to be able to set a set a number and every time it loops through and goes through one item and needs to increment the number up so that it will be able to go through and find the next ones. All right. So let’s go find my workflow that aired out and kill it. And. [59.4]

[00:35:15] Go run it again. [0.8]

[00:35:25] And also in my example blog post that I wrote this example was having a list of people and then for each person in that SharePoint list it would go through a different liche list which is a list of tasks and it would go get all the overdue tasks for that person. So I’d like like to brainstorm like you guys to brainstorm. [23.0]

[00:35:50] And think of reasons and different ways the two reasons you’d want to go you know loop through things so title is Jetson. An email is blank let’s go look and see if that’s correct. Customer contacts. Title So this is Jetson. And e-mail it does have an email address in it. So yeah I’m not sure why you would return nothing but that’s good is at least showing us that one item it is from Contoso. [31.3]

[00:36:27] Maroon I don’t think you finished typing your question but here’s the blog post I just posted it in there. All right. [5.5]

[00:36:34] Now let’s go I could double check what that e-mail syntax is and I could also go get different from different fields too. But we’ve only got like half an hour left. I want to go move move on through to the looping part. So what we’re going to do is we pull this over here. And so what we want to do is NOT go get just those the results from that specific one but we want to go start looping through all of them. So we want to count all the items that it returns so count because we need to know how many times to do the loop count all the items that are returns in this whole data set. So outside outputs to the variable called count and then I need to have an index which is what’s going to count up as it loops for each one. So my index variable is going to be a another an integer. So let’s see oh go set again. Start by setting it to zero it were a variable. [1:07.9]

[00:37:43] Index integer to zero. [5.8]

[00:37:50] All right. And then that’s when I need to start doing my looping. So I’ll go loop. So I want to say loop with condition. Double check the loop with condition. [14.5]

[00:38:10] Loop through contacts. OK this is going to loop repeatedly while. [7.8]

[00:38:20] I could I guess theoretically I could do just loop through this many times whatever the variable count is. So those are a couple of different ways I can do it but I’m just going to come the way I usually do it is. A loop with condition so see do loop while index. [21.0]

[00:38:44] It’s workflow variables and X is less than inputs. [9.9]

[00:38:54] I guess you have a little more freedom when you do this one with condition you have more freedom kind of as it’s running to be able to do stuff. As less than count K and then the things I’m going to put in the loop are going to be going to get a specific result. So it just delete the email and right now I’ll just go practice this. [23.0]

[00:39:17] So in here I need to go get whatever that specific index is. So starting off with zero the value of index is zero. But as I’m going to increment it up. Now if you guys love getting into the nitty gritty and learning about like really deep workflow troubleshooting and getting around in here and logging and troubleshooting not just working in here and being able to understand what all the variables are and things like that. I teach a whole week-long workflows and forms class. And this is mostly what we do is just digging into SharePoint designer 20:13 workflows. It’s not all. It’s not a lot of the web services stuff but it’s a lot of just all this understanding what these working with variables and just a ton of troubleshooting. All right so I’m going to go loop through I’m going to go get the title for each thing and output it to my title and then I’m just going to log it for now. Whenever my title says and then the important part is that I need to add one to the index. [1:11.8]

[00:40:29] So I do a calculation. [1.4]

[00:40:33] So when I say index plus 1 and that way then it will loop through. [8.6]

[00:40:41] You know then it will go through again so set the workflow variable called index to now be this new value and then loop through again and then I’ll get the next item then Eleuthera again etc. and then it’ll get all three of those items that have control. [21.9]

[00:41:03] So as the contact in it will log each one all right soon that’s and then log in a loop and then I’m going to move on to after I show you how this works. [15.2]

[00:41:19] I want to move on to showing you a web service that’s not SharePoint so that’s fun stuff so let’s see. [5.3]

[00:41:36] All right so just real quick I’m going to show you what this is. [2.6]

[00:41:39] If you want to have it it’s called legist scan. [4.6]

[00:41:45] And so think about all the legislatures and bills and things and government. They have an API and it’s a web service. And so it’s a good example of so here’s what your web service call would be. And then it returns a list of information and then that’s when you dissect it and figure out how to go get the specific information you want from it. This could be any web service though for you know could be a web service that a programmer wrote in your company it could be a you know that maybe goes to a SQL database or something. It could be a web service to anything. [32.7]

[00:42:17] So this is one that I’ve been working with for a project I’m on and it’s a web service that taps into legislatures. Maroon it is an online live class or it is self-paced and and the workflow class is for. Well we work in SharePoint designer 2013. We don’t cover that many things that are specific that you couldn’t do in 2010 2010 and 2013. I don’t know if that’s what you’re comparing it to 2020 2010 2013 workflows or have a lot in common there isn’t that much drastically different with 2013. If you’re if that’s what you’re asking. [41.1]

[00:42:59] So yeah. It’s on my website. [4.5]

[00:43:07] All right let’s see it finished publishing and then we’ll go and I’ll show you what that one would look like to go kind of dissect how to get stuff out of it. All right. [7.8]

[00:43:15] So that one published and let’s go run it’s let’s go back to workflows. Sometimes that takes a second and refreshed that page since I republished it. [16.1]

[00:43:42] So are told and you said you agreed that yes you can do different site collections different farms. And as I’m about to show you different completely different systems than even SharePoint. But isn’t there a certain extra set of. Like a different API call you have to do if you’re going across to a different site collection there’s something extra you have to do right are stolen. All right. [27.3]

[00:44:10] I think I just ran it and I just run it. I run it again just for fun just in case. [10.4]

[00:44:27] So. And a lot of the concepts we talk about like the trouble shooting and getting around in concepts like variables and stuff they’re the same in 2010 and 2013. [7.3]

[00:44:36] All right. Look at that. It worked. So it got the three items. Jetson dude man and me me those are right here. So here are the three Contoso ones. So filter by Contoso and it got done. So and returned them. So then it’s going to be up to me to go whatever I want to do with those. [20.3]

[00:44:56] Don’t want to go. Right. Information to those items. Or do I want to take the list of items and concatenate them together and put them in an email or what. What do I want to do. So Sky’s the limit. All right let’s go look at another one. So this is going to be that a completely different database that. We can tap into. So this is going to be legislatures. I go do that. That this queried is legit scan database and this is what it spits back with my Jason. So I’m dissecting it here. So I kind of started putting just carriage returns after I saw all these little curly brackets. So it’s going to have basic information about what a specific bill is. It does have a career you can do to get all of them but this is like once you get all of them you can go query a specific one. So it’s got like the name of the bill. [58.4]

[00:45:55] It’s got progress. It’s got all these different updates that happen. So all these different all these things happen with it where they make updates. They have meetings and things like that. And these are all updates. But then it’s got like these separate little sub tables in it. It’s got sponsors. So it’s going to have a list of people. This one is only got. A couple. So it’s got a few people here like it’s got people’s names. So it’s got a list of people. So these are all like the sponsors for that bill in the legislature. So it’s going to have a sub table of all these people so here all their names and Scott like their first name last name etc.. So if I want to go in here and get what party that person is with I can go get go type party as you know get when I’m getting my results out of here or I can do name. So that’s where I can like really dig in and say OK I want to go just like we did get the slash results for the SharePoint thing. This would be would be slash sponsors. And then I would say get sponsors and go get their name or something like that. And then I also have another sub table I have a calendar of hearings. So these are all the hearings that happen for this specific that are related to this specific measure so it has what room they’re going to happen in what the name of the hearing is the date that it’s going to happen. [1:30.5]

[00:47:26] So I’m able to go use my web service to go tap in and do this query. Just from a SharePoint designer workflow and go get all this information. So let’s see I can show you some of this stuff. [13.9]

[00:47:45] Let’s show you just like one specific thing with like the people that I did right copy things that are here some are just going to put this in a different stage just I’m not going to put the web service call and everything in here I just want to show you just some of what the things are that involve So get bills sponsors. So when I looked at the J-son we’ve got Bill is the very first sort of that’s where the opening bracket starts. So everything under Bill is all these other brackets. It’s going to be Bill slash. And then it’s boxers was the other one the only way you can find these is by looking at these brackets and curly brackets. And then I go get all the sponsors. So it’s going to get Bill slashed sponsors and spit back a list of people and then it’s going to go counts. All of those items so that I can loop through them and then it’s going to get all their names. And so what I’m going to do is loop through and get all their names and mash them in catnip concatenate them together into one value so that I can just say have a field in SharePoint that just says sponsor names and it’s just got so-and-so first name last name, comma first and last name come bubble. [1:37.3]

[00:49:23] So I’m mashing them all together some looping through every individual sponsor and I’m mashing them all together so that I can have them in one field so it goes and gets their name. [9.7]

[00:49:33] So where did I get a name that is going to be right here. See sponsors slash the name. And that’s their first name last name. This is stuff that I’ve been figuring out and working on over the last two or three weeks or so so I’ve been like very immersed in it that’s kind of why I wanted to share it with you so goes and gets their name and announcement outputs it to a variable. So that’s a committee person that’s one person. And then it goes and counts to the next number up. But then what I want to do is if it’s the if it’s the last person I don’t want to put a comma after their name. [36.7]

[00:50:10] But every other person I want to put a comma after it. So again this could be SharePoint this could be some other place like whatever you’re using. These are all things that you can do with any kind of data that you’re that you’re wanting to go get or loop through. So it’s basically saying if it if it’s the last one. [19.9]

[00:50:31] If the index equals the count then it’s just going to say set person comma to just the person’s name. That way it won’t have a comma after it. But if it’s anyone else in the list it’s going to say what this variable and then put a comma space. [15.9]

[00:50:48] So basically at the end it’s saying committee people and it’s mashing together all the people it’s accumulated so far that it’s loop through with that last one and then it spits it all out as a field with a bunch of people’s names in it. Just blow your mind or what I mean. So this workflow that I’ve been working on is like it’s probably six pages long like you know scrolling down because it’s going into this that data source and it’s going and getting all those sort of little sub tables full of information that kind of fun right. [37.9]

[00:51:33] Let’s see you guys have some comments. Well let’s see. [4.2]

[00:51:39] Oh OK. Yeah. Well and that was token to cross site collections is there a reference that you have for that to be able to kind of what those actions need to look like in the workflow. I think I’ve done it at some point and maybe found it on some of his blog posts but but yeah there there is that extra thing you need to be able to do to go across site collections or incest of the day Sunday to get back be rendered in a SharePoint web page. Maybe but you’d probably want to just have it put the data in a SharePoint list and that way it’s nice and neat data and it’s not just like a whole bunch of gobbledygook. So that’s kind of the whole point of being able to iterate through those items so you can do something nice and neat like put it in a shopping list. Apparently I was showing something that my head was in front of. Sorry about that. See let me go back to my other. [56.3]

[00:52:39] OK we’ll just talk through some of your questions we’ve got since we’ve just got a few more minutes left. Yeah maroon if you wanted to go. [12.0]

[00:52:52] Present a bunch of data I would use the content search web part for that to be able to go just if you want to just show some live data from SharePoint. Usually when you want to go loop through things it’s going to be OK. Well I want to take the subset of data and do something with it like change it alter each item and do something with them or like put them in an email or like for overdue tasks and things like that. So I don’t think that this is going to looping through things and SharePoint out think you’re going to use a scenario where you’d want to just display that on a page you know you’d use like the content search what part you use this so it’s just kind of a different use case for that. [42.2]

[00:53:38] What’s the best practice recopying piecing workflow from one site collection to another. [3.8]

[00:53:46] We can’t copy and paste from a 2010 workflow to a 2013 one you have to. It has to be 2013 to 2013. So I would just recreate it. If you’re trying to go from one site and another just the neatest way is that’s just what that’s what I do is I would just specially if it’s from 2010 to 2013 because you can have different actions in different ways you might want to do things. [26.5]

[00:54:14] Yeah. Let’s see. [8.8]

[00:54:26] Yeah. Content search we’re partnering. [1.8]

[00:54:29] All right so you see some people making comments. The other one. Let’s see if you guys want to maybe we can do a little bit more with that data that we had in SharePoint and go like do something further with it like. [17.4]

[00:54:49] MIT. So like make the workflow loop through the items and then do something with them and then put them like concatenate them together. [6.4]

[00:54:55] We can do that for the next six minutes just. OK. So we’re going to go back to them and take this thing. The legislature out of here. [7.4]

[00:55:05] And then so we’re looping through contacts so what do we do with them once we loop through them. So the way that I was the way that I was doing it here was I was creating just a string variable and as I loop through each thing I was adding it to that string variable. [19.1]

[00:55:28] Another thing you can do is get the idea of the item and do something with the item. So let’s go see let’s get copy and paste go get that Id like that and call it. Wonder if it would need it to be a strain with the idea it will just do it as a string in a safe way to do it. [29.7]

[00:55:59] And then I can go do something to that item I can go update update item in this list so I can go over to my current customer contacts list and I can say set this field status to inactive. So everything that’s Can toso I’m going to set it to inactive where the ID. [27.5]

[00:56:28] Is equal to basically this ID that I just got for this item. So I’m inside the loop here. So this is going to be that specific ID. Some niggas set the status so as it goes through each one one at a time in this loop it’s going to go set it to inactive. [14.6]

[00:56:45] I can also like for this one I just hardcoded can toso in here but that could have something else like let’s just say I had a parameter like a workflow parameter so I can go create initiation parameter and I can say customer I’m just going to do just text in the real world you might want to have like a drop down box. So when you start the workflow you type the name of the customer that you want to deactivate and and then that way when it does this call. And goes in filters by the customer it’s going to equal whatever. [36.2]

[00:57:22] You typed in your parameter. [3.0]

[00:57:26] Fun stuff right. But it’s still in quotes. OK. And then it’s going to go update the item and make them inactive and it’s going to go let’s see I’m going go set a variable called string of string of people. To. [22.1]

[00:57:52] Set it to anything but peaceful means. Oh look at my blog posts to see when I when I created like this string at the beginning my setting it does something. [14.7]

[00:58:19] It’s hard to figure out my way through that thing. All right. Set a string of people to blank just starting an office blank and then set. [13.3]

[00:58:36] A string of people to a string of people to it. So. And then this new person that just got. This new contact. Is going to be title. [21.5]

[00:59:01] And go. OK so it’s going to loop through all those get it out sedum is active and we’re going to try all that out in the next two minutes. [8.8]

[00:59:14] Not sharing my screen anymore. OK. Let’s find out. [2.0]

[00:59:16] Thank you. Corey like probably trying to text me or something oh god I love this air. OK so I’ll show you in a second what I did. [7.2]

[00:59:26] I got a tweet. Whenever you get this error this is a very very common error in SharePoint designer 2013 workflows. Basically if you let it leave it open for a few minutes it will. It will just time out. So then when you try and publish a workflow it tells you that the connection with the underlying connection was close. Have you guys seen that happen. [20.0]

[00:59:50] Sorry. Sorry I wasn’t sure. My screen just taken a second. [5.9]

[01:00:07] There’s just a 30 second delay. So you guys were typing 30 seconds ago that I wasn’t sure was green. But now it’s just publishing. So it’s going to take the next two minutes of power hour to publish what I did. But I’ll I’ll do a recap real quick if it would ever finish. So you’ve got to love that because it tells you that they won’t publish it because the underlying connection was closed. You have to refresh it. But then it goes and finishes through this progress bar while while it’s telling you to wait that it won’t publish it. [33.7]

[01:00:41] So so now I’m refreshing it. OK so what I did was I created an initiation form parameter. That’s text. It’s just a single line of text. And then I’m going to I’m getting the ID of the item. So there’s copy this title and made it id and create a variable called my ID and then I’m going to update the customer contact where the ID is equal to this variable. So I’m going to edit that item in SharePoint and I’m going to set the status to an active. All right. And then this string of people thing is I’m I’m trying to concatenate together just the titles of the different contacts some setting my string of people to itself plus this variable my title. [45.7]

[01:01:27] All right. So it’s finished and finished refreshing. No sorry about that guys. That’s what I get for switching back and forth. All right. It is still doing something. [14.6]

[01:01:46] All right publish finally. [2.7]

[01:01:50] OK so here’s me go back over to the site and I’ll add one more thing in there to show you how you can make this just do this on a loop. [10.4]

[01:02:00] Actually my work my blog post shows you how you can do it to make it pause. So you just add your you and your pause in there see pause until tomorrow. So of course she would say you know pause for 24 hours or something like that. But that’s how you do the stages. And Aaron he wrote that down. [19.5]

[01:02:21] All right. Oh thanks. Our Toland for the information about oh about that for the last thing came a refresh this. [11.1]

[01:02:39] Perfect. OK. [1.3]

[01:02:42] And so now let’s make sure that it finished publishing. No kidding. [3.9]

[01:02:53] This that’s a new one that’s awesome. Sure that’s related to maybe it’s my string of people. [8.3]

[01:03:04] All right was just trying to kind of throw in a few extra things at the end there. [3.5]

[01:03:20] Yeah. I don’t know if I have time to wait for that thing. [1.8]

[01:03:22] But the idea was that I was putting the name of a customer going to type the name of a customer and when I start the work flow in that way it would whatever the name of the customer that I typed in that would be the customer that it would filter by. [16.2]

[01:03:38] So soon as this finishes spazzing out over here I’ll show you that but we kind of have to stop right. [9.5]

[01:03:51] Well those are a lot of good links. Thanks so much. Good stuff. [3.2]

[01:03:54] And then there are also the links that I wrote in my blog post about this one hour does not do the stuff justice but the idea was that instead of just you know reading blog posts that kind of explain how to do some of this stuff I was trying to show you kind of what the data looks like and how it’d be able to go interpret it yourself. So this is where this is the part that you guys missed earlier where I said company equals and then parameter customer in that way I would have that parameter as whatever customers type in would be the one. That would query so. [34.9]

[01:04:31] Let’s say we’ll see that publishes one more time and then that will be done. Thank you for the applause. I like it. There’s still some things I wanna start now. Is there. Any last questions. For those of you who have done this before. Any. [20.4]

[01:04:54] Examples that you wanted to share. Mr.. [2.9]

[01:05:00] Y my work SharePoint designer workflows are taking so long to publish. Today it’s just that it loves me. [5.7]

[01:05:17] Gotta love just sitting here watching a Vargrave across the page. I really just want to show you that one more thing and I. [7.3]

[01:05:29] All right so other examples of this could be just needing to do anything that goes across to different sites and site corrections. I [8.4]

[01:05:38] mean that’s huge. OK. We’ll go kick this off one more time. Refresh this shit ask me for a company and I’m just going to type in control so just to be safe so I know that’s what I’ve been using. [12.6]

[01:05:53] Some triggering my workflow so ask me who it is. So instead of me hard coding can toso so into the workflow the person typing in control so. [9.7]

[01:06:06] Thanks guys. [0.9]

[01:06:07] All right. Now let’s see if magic is happening. It should be going through at least and setting all those to inactive. [8.7]

[01:06:21] Log down. Let’s go see. It hasn’t done it yet so maybe we’ll see. [10.4]

[01:06:32] It’s sometimes these things take a minute. [8.4]

[01:06:42] What am I doing next week. I don’t know. [1.5]

[01:06:46] Started. I don’t know if that’s a good sign or not. So it’s still running. It’s just thinking about it. Completed. OK. Let’s go see what it did. Customer contacts. [17.3]

[01:07:06] Like that it worked. It set my three toso contacts as an active with hoo. All right. Done. [5.4]

[01:07:12] OK. We’ll act. This. Thanks everybody for coming. I’m not sure what I’m doing next week. Put some suggestions in a little general tab under channels. I’ve just been immersed in this workflow Web services stuff in the past couple of weeks so that’s why I wanted to do that this week. But thanks everybody for coming. See you next time. [21.2]


Summit Bundle

Get 200+ hours of Microsoft 365 Training for 7$!

Master Office 365, Power Platform & SharePoint & Teams With 200+ Hours Of Training Videos in the Collab365 Academy. This offer is insane and is only available for a limited period.