SharePoint Power Hour: Workflow Web Services

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello welcome everyone I'm Laura Rogers and this is SharePoint power our my weekly show where I talk about just a lot of different SharePoint topics every Wednesday at 11:00 central we go over ton of 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 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 in the description of this YouTube video there is 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 or an invite to slack it's iw mentored slack comm and we have a little power our hashtag power our channel in there and that's where we have all of our conversation going on so let me go ahead and get my link shared in there let's say and do that and there we go all right web services and I'll put it in here too so if you guys are watching in the chat now you have a link to where the live show is I did go ahead and put a 30-second delay on the 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 there'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 at the whole reason that I do this live is that I'd love to get you guys interaction and ask you questions and get sort of feedback as I'm going and and makes it a lot of fun it makes it you know it's a community effort so let me go ahead and tweet out and say we're alive I started just streaming straight to YouTube directly from my computer instead of doing the Google hangout so I just now have a link we'll figure it all out you know make it smoother sooner this is gonna be mostly a demo it's a lot of fun all right tweet okay all right so workflows and web services I did write a blog post yesterday if you go to wonder Laura com where I talked about what we're going over in power are today just some 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 its bordering on dev and you know I'm not a developer I'm not a programmer I don't know what JSON is or what rest is but I figure it out as I go so that's kind of what we're gonna be doing here so again welcome everybody come say hi and I guess you all can see me and we're streaming live so when I'm streaming live directly from my computer it doesn't let me do the Google hangout with other people in it like Corey so um that's uh 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 there we go and go to my little tent down shrink that down a little is fun this is that software that lets me stream live while I'm talking okay actually okay so here's 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 and here kind of like the this is sort of the what I wrote on my blog post what 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 then we're going to talk about sort of what structure that it's going to expect in different ways to make it more efficient and so that's gonna be really important especially when a lot of times we use web service calls you know to be able to loop through things in a list in 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 in a large list or even if you want to just be able to go get one item that's they're 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 the tapping of the web service is going to send information about just the fact that it's using JSON so it's just a little bit of sort of structural information that it needs so let me go ahead and pull up your point designer and do a new list workflow I'm just going to do a list workflow actually I'm gonna do a workflow that has a site workflow because a lot of times when I'm looping through items in a list or library it doesn't necessarily need to be based on something happening on a specific item in a list or library it just made to be running and maybe it needs to run at an interval or something like that so this that's what I'm going to do it's what I do a lot of the times with these looping ones and so that's what I'm going to do in this case is I'm going to make it so it's it's a site workflow so it's not specific to any list or library tests web services and then click OK alright and you guys let me know in the chat window have you 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 I've actually learned a lot since then since I wrote that post so 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're gonna start out with a dictionary now I actually have I'm gonna 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 gonna 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 accept and a content type and don't ask me what any of this means because I don't know accept and if those of you who are doves in this chat window know exactly what this means and when it's for feel free to chime in but this is just the same Burbidge Burbidge that i do and every single one of these that I need to have alright 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 for my other workflow where I call the web service yeah copy that all right like that now let's go open up notepad actually yeah no pen let's just do notepad and look at some of this information so this is your current site right here at the beginning so it's gonna be the site and then this VT I've been blah blah client service now this get my ID 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 then 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 wanted to get confused so in this case I just use the gooood you can get the gooood if you are not sure what the gooood is like this one I'll go get it customer contacts is gonna be my list and when I go to list settings this is the gooood right here and then I actually have a URL encode decode page that I like to do to be able to get there 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 so now I have just a good old number that I can use and copy that and so now I have my gooood alright so let's go back to the notepad so this is gonna be the gooood 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 just I can just delete this part and just have slash items and when I so when this web service it query gets queried it's just going to have pull back all the items in the list and that's what I did in the blog post that I wrote but you can actually filter it here so that way I can narrow it down so I can pull backs fewer so I don't have to go and do filtering and loop through and you know figure out to how to narrow it down later on once I've already gotten all the in all the data does that make sense so I can just filter it later all right let's go let's go see what this date is gonna look like so I'm gonna 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 and so and I can even do a couple of different filters too so I could say you know company equals contoso and 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 field called is it called company I need a double check so when I hover over this I can see in the very bottom in the little status bar 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 so I can say filter where company equals and I can just type contoso right here so I'm just gonna type it for now and then maybe we can change it later just to kind of you know what kind of work we'll work our way up to more complexity so filter company equals contoso and you have to put it in little quotes and so I'm going to take this whole thing and go over here call this web service and then paste it in here and then for the current site I need to have I can use the little workflow context current site URL there we go and if it was looping through like the current list I could do like you know current list let's see if I was in a list it would it would have options for like what's the list name or the list gooood too so but i'm doing a site workflow alright so I'm going to go loop through all those and pull back everything where company is equal to contoso and I'm getting it so I'm doing the HTTP GET alright so what about all this other stuff so the way that needs to be set up is request headers I'm actually going to pull up the advanced properties of this thing request headers needs to be variable dictionary and then response content is gonna be like a JSON thing that I'll create so request headers is going to be that dictionary that I used 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 JSON and it's got that weird JSON string that we you know I'm not a dev so but that's that's a good thing about some of this is that I'm sort of translating some of the stuff it's just 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 okay let's see C response status code already has this response code in it and then this other one that's important that I can only get to from the properties is the one call let's see response content create a new variable SP lists JSON is what I'm going to call it that's a dictionary okay that's where it's gonna give me back the information so this is where I'm gonna 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 let me do a will just test this we'll go to the end of the workflow now once I get this information I can't do a log to history list a lot of times in workflows I like just using walk 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 what the blog post had in it but I didn't really understand why or what it was jim says can it go across sites or his 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 d 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 lock it to history list because it's gonna dump back a whole bunch like a whole big long just string of all kinds of stuff so I can't log into history list because it will give me an error because it's more than 255 characters so what happens is I'm gonna 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 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 gonna go ahead and we're dissecting this and showing you how it works as we go all right I'm gonna say and make it multiple lines of text and plain text is fine and then for that title field I'm just gonna make it default to just something just so that it won't get me an error just or I could 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 recognizes what I changed and then we'll go see and look you know look at what it gives me back okay and then I'll go create create I'm item in my test list oh my test list is not showing up because I didn't wait long enough for it to finish refreshing come on SharePoint you can do it I'm just gonna go look over here and see there's no reason for this thing to be slow yeah so the cool thing about this concept of web service is 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 to 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 in an email or delete them or you know whatever you want to do with them so I'm gonna go let's see if my list is showing here now test there we go so I'm just gonna say X and then set my field stuff to say whatever the heck is in this JSON thing and publish so I'm 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 and I got a 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 little wallet while we're waiting for that thing to publish I know what's taking 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 and libraries and look like the titles of them and has where we can go do things with the items so what we're doing right now is we're doing things with the item so I did get by the get by gooood 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 informations that's going to help you put together that that web service query that I showed you and again I'm not a dev I 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 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 psych 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't do with a normal with just normal workflow actions so my workflows still publishing sale that a couple more people and who are requesting to access it well yeah I've got about 50 people y'all in a list of people that have requested to join this and and hadn't joined so I sometimes I'll go recent send the invitation but a lot of times I think people's email servers are blocking it I've never seen a workflow take this long to publish that's awesome alright so again so what we're doing in this example is we're going to this we're going to the list and we're we're getting all the information from the list but you can get information from a list by like the fields in the list ooh 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 or all the lists on my site or what if I want to go obtain you know and see what all the users are who they all are are groups the group's thing seems really useful because sometimes people need to be able to just quickly see what those are the course there's an out-of-the-box web part for that but that's going to be really useful maybe for more custom solutions and then this would be able to you be able to go get particular folder in this case it's calling a library of folder and in this case you can go get specific files out of here so but what I'm doing is just list items all right it published finally all right so how do we run a site workflow we go to site contents and we go to site workflows so well the time what I do a lot of times with these workflows that loop is I'll just maybe have it run and loop and then run every few hours or something or 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 loop through that and and go just get that whole list of tasks and then have the workflow loop you know once a day and just pause and then loop again and be able to go get all that information is that sound useful to you guys this some of this sound like it's stuff that you would want to be able to do so sharing points of view there are ok so an example that I'm doing that I've done before is looping through a list of tasks and going through the list of tasks and looking for tasks that are overdue and putting together a list overdue tasks and being able to send that in an email this is or one thing that I do just for myself with my own company is every Monday morning I have my timesheet which is a SharePoint list that I fill out and I want to be able to send each customer the list of timesheet items that I've logged for their projects so I look at ran yay so it ran so I so it loops so I just kick it off and it runs on Monday and then it I put it all in an email together and it sends my customer a nice little neat email with a little table in it listing all the time that I log that week for their projects so those are a couple of examples let's do my little kind of my little test list okay cool and go to my items 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 one I was doing that's a web service let's go do another one I wasn't getting scary all with some of that stuff all right now for language I can change this to JSON and that way it kind of puts it in a little format for me sort of alright now what do we have here we have D : results I can start sort of splitting things off where I see these little curly brackets and then I have this metadata thing and then I have just some information about my list I'm kind of looking for these little curly brackets to be able to figure out kind of where I can divide this alright so it looks like I've got information about the list itself like content type whether it's got a document information policy things like that and then I've got fields and let's see where my items here we go here we go let's see 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 gonna make sense job title engineer cell phone blah blah blah so this is all the information about one particular item in my list right here so the way JSON is structured is I need to know it's sort of like a subtitle table inside of it 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 so what I'm going to do is I'm going to use this D in 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 JSON and what I did is I just googled what is JSON and then just and then I realized that that's kind of how it how they have it structured into like these little sort of brackets determine sort of little sub tables inside of here so it's all good all right so I'm gonna go to my work flow 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 I want to go get those items so I'm going 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've read blog posts about how to go get you know sharepoint web service information it'll always say get d slash results so if you ever want to know what the heck D slash results is that's where it comes from that's sort of the way it's structured in the Ehsan so I'm going to output that out to this a list take this set as a dictionary and then I want to this is where you can decide what you're gonna do so what would I do with my results next so there it's gonna give each result an index number like a like for example the first item that I come to let'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 two three where actually I think it's going to be zero one two so as it iterates through them it's going to go zero one two and it's gonna 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 in here all right so how do you structure that so I go get so it's just getting all my results but let's go look at get and I'm gonna do its title so I'm going to do title so title is gonna be just whatever that generic title feel every single list and share point has a title field so you can't go wrong with that so then I also had another one called company I already know I filtered them all by that company called contoso but I can go get another one like email I could do that so let's go see what I've got email I've got status let's go 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 bar down at the very bottom of the screen so I'll go get email all right copy that and I'm spitting it out to a variable so this is gonna go find the first result zero and it's gonna spit it out to be and this one's gonna be like my email is a string and my title is a string okay now we can log what it's doing so logged title and then just kind of tell me what the heck is in these variables that it's getting my title and email my email so I'm just going and getting to particular like from the very first item zero that it comes across its gonna go get the title and email from that item and its gonna spit it out in a log all right you guys are very quiet yes you're right five eleven seven changing the language setting to JSON 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 its gonna just go look at the JSON again now what its gonna do is it's gonna go find item zero which is going to be the first thing that comes across and it's going to let's see it's gonna have a like a where is it it's hard it's really hard to decipher this 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 it 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 gonna 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 contoso so then we would go and we'd have to increment that number up this little index number all right so let's go back to our site and we'll go we're gonna go run our workflow again just manually kick it off because we're testing I don't think that column names are sick case-sensitive no and please work this time okay so it's running let's go see what it's doing all right it's suspended ooh looking up a value using a key is not supported or an on an instance okay that's fine looking up a value using a key all right what does that mean let's go see results oh let's see that's what I did I use the wrong 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 I'm looping through and point out a couple things all right so I wrote this down where I'm gonna and I tell you how to do this little accepting 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 gooood and what to put when you're getting the items from the dictionary the D results but now you've seen kind of what that D results looks like like the raw code so now you can kind of 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 it needs to increment the number up so that it will be able to go through and find the next ones alright so let's go find my workflow that error it outs and kill it and go run it again and also in my example blog post that I wrote the example was having a list of people and then for each person in that SharePoint list it would go loop through a different Lich list which is a list of tasks and it would go get all the overdue tasks for that person so like I like you to brainstorm like you guys to brainstorm and think of reasons in different ways that you reasons you'd want to go you know loop through things so title is Jetson and email is blank so let's go look and see if that's correct customer contacts title so this is Jetson and email it does have an email address in it so yeah I'm not sure why it would return nothing but that's good is at least showing us that one item and it is from contoso maroon I don't think you finished typing your question but here's the blog post I just posted it in there alright now let's go to I could double check what that email syntax is and I could also go get different some different fields too but we've only got like half an hour left I want to go booth move on through the looping part so what we're gonna do is me 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 it returns in this whole data set so outs 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 through each one so my index variable is going to be a another an integer so let's see I'll go see I gotta start by setting it to 0 set workflow variable index integer to 0 all right and then that's what I need to start doing my looping so I'll go loop so I want to say loop with condition double check yeah loop with condition through contacts okay this is gonna loop repeatedly while and 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 gonna do kind of the way I usually do it is loop with condition so let's see I'm gonna do look while index it's work flow variables index is less than and then put I guess you have a little more freedom when you do this one with with condition you have more freedom kind of as it's running to be able to do stuff is less than count okay and then the things I'm going to put in the loop are going to be going to get a specific result so I'm gonna just delete the email one right now so let's just go practice this so in here I need to go get whatever that specific index is so it's starting off with zero the value of index is zero but it's I'm gonna 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 you're not just working in here and being able to under damn what all the variables are and things like that I teach a whole week long workflows in forms class and this is mostly what we do is just digging in the SharePoint designer 2013 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 alright so I'm gonna go loop through I'm gonna go get the title for each thing and output it to my title and then I'm just gonna log it for now log whatever my title says and then the important part is that I need to add one to the index so I'm going to do a calculation so I'm going to say index plus one and that way then it will loop through you know then it will go loop through again so set the workflow variable called index to now be this new value and then it will loop through again and then I'll get the next item then will loop through again etc and then it'll get all three of those items that have contoso as the contact and it will log each one alright so get rid of that and then finish loop and then I'm going to move on to after what after I'll show you how this works I'm going to move on to showing you a web service that's not sure point so that's fun stuff so let's see all right so just real quick I'm going to show you what this is if you want to I'm gonna it's called legend and so think about all the legislators and bills and things in 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 sequel database or something it could be a web service to anything so this is one that I've been working with for a project I'm Ron and it's a web service that taps into legislators Maroun 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 twenty twenty twenty ten twenty thirteen workflows or have a lot in common there isn't that much drastically different with twenty thirteen if you're if that's what you're asking so yeah that's on my website alright let's see if 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 alright so that one published and let's go run it alright let's go back to workflows sometimes that takes a second and refresh that page since I republished it so our Toland 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 not even sharepoint but as it 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 tolling all right so I think I just ran it did I just run it I'm gonna run it again just for fun just in case all right so and a lot of the concepts we talked about like the troubleshooting and getting around in concepts like variables and stuff they're the same in 2010 and 2013 all right look at that it worked so it got the three items Jetson dude man and me me and those are right here say they're the three contoso ones so filter by contoso and it got da da da so and it returned them so then it's going to be up to me to go whatever I want to do with those do I want to go right information to those items or do I want to take that list of items and concatenate them together and put them in an email or what do what do I want to do with 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 gonna be legislators I go do that that this query to this legend database and it this is what it spits back with my JSON 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 gonna have basic information about what a specific bill is it does have a query 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 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 gonna have a list of people this one has only got a couple is 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 as it's in the legislature so it's gonna have a sub table of all these people so here all their names and it's got like their first name last name etc so if I want to go in hearing yet what party that person is with I can go get go type party as you know getting when I'm getting my results out of here or can do name so that's where I can like really dig in and say okay I want to go just like we did get D slash results for the SharePoint thing this one B 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 gonna happen in what the name of the hearing is the date that it's going to happen 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 go see i can show you some of this stuff i'll show you just like one specific thing with like the people that i did alright copy/paste that over here so i'm just gonna 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 the what the things are that involved so get bill slash sponsors so when I looked at the JSON we've got bill is the very first sort of that's where the this opening bracket starts so everything under Bill is all these other breakfast so it's gonna be Bill slash and then sponsors was this other one the only way you can find these is by looking at these brackets and curly brackets so then I go get all the sponsors so it's going to get bill slash sponsors and spit back a list of people then it's gonna go counts all those items so that I can loop through them and then it's going to get all their names and what so what I'm gonna do is loop through and get all their names and mash them and catenate concatenate them together into one value so that I can just say have a field and share point that just says sponsor names and it's just got so and so first name last name comma first name last name comma blah blah blah so I'm mashing them all together so I'm 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 so where did I get name that is gonna be right here see sponsors slash 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 one up why I wanted to share it with you so it goes and gets their name and an ounce of it 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 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 if the index equals the count then it's just gonna 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 put this variable and then put a comma space 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 looped through with that last one and and then it spits it all out as a filled with a bunch of people's names in it they'll 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 is it kind of fun right let's see let's see okay yeah our tool and the OAuth token to cross site collections is there a reference that you have for that to be able to kind of what those actions and we need to look like in the work flow I think I've done it at some point it may be founded on somebody's blog posts but but yeah they're there there is that extra thing you need to be able to do to go across site collections Maroun says could the JSON data you 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 garbled ago so that's kind of the whole point of being able to iterate through those items is so you can do something nice and neat like put it in a SharePoint list apparently I was showing something that my head was in front of sorry about that let's see let me go back to my other okay 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 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 that's going to be okay well I want to take this subset of data and do something with it like change it alter each item and do something with or like put them in an email or like for overdue tasks and things like that so I don't think that this is gonna looping through things in SharePoint out think you're gonna use a scenario where you'd want to just display that on a page you do you'd use like the content search web part you you wouldn't use this so it's just kind of a different use case for that what's the best practice for copying pasting workflow from one site collection to another well you 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 cycle extension now they're just the neatest way is that's just what that's what I do is that which is especially if it's from 2010 to 2013 because you're gonna have different actions in different ways you might want to do things yeah let's see yeah content search web part maroon alright so um let's see we had some people making comments and 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 me so like make the workflow loop through the items and then do something with them and then put them like we concatenate them together we can do that for the next six minutes let's just do that okay so we're gonna go back to I'm going to take this thing about the legislature out of here 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 another thing you can do is get the ID of the item and do something with the item so let's go see let's get copy and paste go get the ID oops like that and call it wonder if it wouldn't need it to be a string with the ID I think we'll just do it as a string this is safe way to do it 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 customer contacts list and I can say set this field status to inactive so everything that's can toss oh I'm going to set it to inactive where the ID is equal to basically this ID that I just got for this item so I'm inside the loop here so this is gonna be that specific ID so I'm gonna go set the status so as it goes through each one one at a time in this loop it's gonna go set it to inactive I can also like for in this one I just hard-coded contoso 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 an initiation parameter and I could say customer I'm just gonna 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 gonna equal whatever you typed in your parameter ooh fun stuff right but it's still in quotes okay and then it's gonna go update the item and make them inactive and then it's gonna go let's see I'm gonna go set a a workflow variable called string of string of people to think I need to set it to anything but default let me see I was looking at my blog post to see when I when I created like this string at the beginning am i setting it to something oh it's hard to figure out my way through that thing all right set string of people to blank just starting it off as blank and then set string of people to string of people to itself and then this new person that it just got this new contact so this is gonna be title and go okay so then it's gonna loop through all those done it at uh set um isn't active and we're gonna try all that out in the next two minutes oh I'm not sharing my screen anymore okay that's fine I'll thank you Cory's like probably trying to text me or something oh I've got to love this error okay so I'll show you in a second what I did I gotta wait 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 timeout so then when you try and publish your workflow it tells you that the connection when the underlying connection was closed have you guys seen that happen sorry sorry I wasn't sharing my screen it's just taking a second there's just a 30-second delay so you guys were typing 30 seconds ago that I wasn't sharing my screen but now it's just publishing so it's gonna take the next two minutes of power hour to publish what I did but I'll do a recap real quick if it would ever finish so you gotta love that because it tells you that it 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 Wow while it's telling you to wait that it won't publish it so so now I'm refreshing it okay so what I did was I created 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 just copy this title and made an 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 inactive all right and then this string of people thing is I'm trying to concatenate together just the titles of the different contexts so I'm setting my string of people to itself Plus this variable my title alright so it finished it finished refreshing yet no sorry about that guys it's what I get for switching back and forth huh all right it is still doing something all right publish finally okay so here's let 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 actually my work my blog post shows you how you could do it to make it pause so you just add your you would add your pause in there see pause until tomorrow so of course you would say you know pause for 24 hours or something like that but that's how you do the stages and I already wrote that down all right oh thanks are Toland for the information about out about that for the oauth thing came and refresh this perfect okay and so now let's even make sure that it finished publishing no kidding me oh that's a new one that's awesome sure what that's related to maybe it's my string of people all right well it's just trying to kind of throw in a few extra things at the end there but let's see yeah I don't know if I have time to wait for that thing but the idea was that I was putting the name of a customer you're going to type the name of a customer in when I start the workflow and that way it would whatever name of the customer that I typed in that would be the customer that it would filter by so as soon as this finishes spazzing out over here at all I'll show you that but we kind of have to stop so alright um wow those are a lot of good links thanks so much yeah good stuff and then there are also the links that I wrote in my blog post about this of course one hour does not do this 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 to 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 and that way I would have that parameter as whatever customer I type in would be the one it would query so let's see we'll see if it publishes one more time and then that'll be done oh thank you for the applause I like that there's dancing with it dancing with the start now is that any last questions or those of you who have done this before any examples that you wanted to share let me close this stuff I don't know why my work SharePoint designer workflows are taking so long to publish today it's just it loves me you gotta love just sitting here watching a bar girl crawl across the page I really just want to show you that one more thing and I yeah alright so other examples of this could be just needing to do anything that goes across to different sites and site collections I mean that's huge okay we'll go kick this off one more time let me refresh this and it should ask me for a company and I'm just gonna type in contoso just to be safe so I know that's one I've been using so I'm triggering my workflow so it asked me who it is so instead of me hard coding contoso into the workflow the person is typing in contoso thanks guys all right now let's go see if magic is happening it should be going through at least and setting all those two inactive ok logged on let's go see ah it hasn't done it yet so maybe we'll see if it's sometimes these things take a minute what am i doing next week I don't know started oh I don't know if that's a good sign or not it's so it's still running it's just thinking about it completed okay let's go see what it did customer contacts oh look at that it worked it's set my three contoso contacts as an active whoo-hoo all right done okay well um back to this thanks everybody for coming I'm not sure what I'm doing next week put some suggestions in the little general tab under channels I've just been immersed in this workflow Web Services stuff in the past couple weeks so that's why I wanted to demo that this week but thanks everybody for coming see you next time
Info
Channel: Laura Rogers
Views: 8,086
Rating: 4.448276 out of 5
Keywords: SharePoint, Office 365, workflows, SharePoint Designer, web services
Id: 5ZP9lp-a9pw
Channel Id: undefined
Length: 67min 35sec (4055 seconds)
Published: Wed Oct 12 2016
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.