reosoftproductions.com
RODNEY AND ARLYN'S WEB SITE

SharePoint Designer 2013: Custom Workflows

SharePoint Designer 2013 SharePoint Designer 2013: Custom Workflows

SharePoint Designer 2013: Custom Workflows

Introduction

Welcome to SharePoint Desiger 2013: Custom Workflows. In this course, I'll be showing you how to create and document workflows, steps that are taken automatically by SharePoint to automate the work in your organization. I'll show you how to use SharePoint's built-in workflows, but then we'll quickly go beyond that to build simple custom workflow steps. You'll learn how to set up workflows to behave the way you want them to behave. You'll learn how to create conditions within workflows so that the workflows themselves do what's necessary without additional intervention, and I'll show you how to create and use forms in your workflows, how to send email notifications and how to incorporate core workflow actions, such as performing calculations, storing values and creating, updating and deleting list items.

We'll also look at two types of workflows, that can be reused within SharePoint: reusable workflows and site workflows.

What You Need to Know

Before we jump into workflows, I would like to talk to you for just a few minutes about the tools that we will be using in this course. I'll be using SharePoint online. Actually SharePoint Server Enterprise 2013, running as part of Office 365. But, you don't need to have the same type of SharePoint or the same installation that I have. For example, your organization may have SharePoint Server Enterprise, or SharePoint Server Standard installed and hosted there. Or your organization might be using SharePoint Foundation which is the most broadly distributed version of SharePoint because it comes packaged with Windows Server. So organizations that have a Windows Server, already have SharePoint Foundation and they could use it. Each of these versions of SharePoint allows your users to collaborate, to share documents and lists, and allows them to launch workflows that you've created. So yes, you can create workflows with SharePoint Foundation.

You'll also need to have SharePoint Designer 2013 because this is our development environment, our primary tool. And we will use it to build workflows although it has other purposes. I can create lists and libraries, and entire SharePoint sites using SharePoint Designer 2013. There are other courses that use SharePoint Designer for things like site branding. SharePoint Designer 2013 is a multi-use development environment, but we will be using it specifically for workflows.

If you have a prior version of SharePoint Designer, SharePoint Designer 2007 or SharePoint Designer 2010, those won't work. Microsoft has re-imagined, how workflows work with SharePoint 2013. And you can't create new workflows with the old tools. So you will need to download SharePoint Designer 2013, even if you have a prior version.

Some version of SharePoint in 2013 and SharePoint Designer 2013 are all you need to create workflows. But there's other software that's optional and very useful. For example, if you have InfoPath Designer 2013, which is another free download, then you can use that software to create forms for use in your workflows and we'll be doing that in this course. The forms you create can be filled out by users who are using InfoPath Filler. But depending on the version of SharePoint you're using, you may also be able to create and host browser based forms using InfoPath. If your organization uses SharePoint Server 2013 Enterprise on premises or online, then it also includes the ability to have what are called services. Things that are hosted on the server. One example of a service is Excel services, which allows users to access large workbooks or to work with Excel, even if they don't have it on their computer because it's being hosted on the server.

There are also Visio services that allow your users to view Visio diagrams. Something that you will care about later in this course.

But from our point of view, there is one service we care about more than any other in this regard, which is the ability to be able to host InfoPath forms in a browser. So if you are using SharePoint Server Enterprise, On Premises, or Online, then you can create forms that your users can open in a browser. This means that you don't have to worry about each of them having InfoPath Filler on their computers. It means that it doesn't matter that they use a Mac or they use a PC. Anybody who can get to a browser, can fill out your forms.

You might also have access to some version of Visio in your organization. And any Visio is great because it allows us to create diagrams of our workflows. We can take those diagrams then and print them or publish them and share them for feedback. And diagrams will allow us to get a high quality of information back from our users.

But if I have Visio Professional 2013, I get much more with it. I have the ability with Visio Professional to create workflows right in Visio, to not only share them for feedback but to export them to SharePoint Designer or to take workflows that I created with SharePoint Designer, and turn them into diagrams that I can then, share with my users. If you have Visio Professional, you really have a second development environment. Because now I can design not only in SharePoint Designer but I can design in Visio. Take things back and forth.

And there's one more thing that's really cool about Visio. Many organizations have a built in pool of current or past Visio users. Maybe people in engineering or some business analyst, some folks in IT, or some folks in, in marketing and creative. And any of those folks can create workflows using Visio. So, they can start a workflow in Visio Professional and then save it and give it to you, so that you can do more work with it, if you wish, in SharePoint.

Developers in your organization, and you may be one of them, probably have Visual Studio which is a complete programming environment. Visual Studio allows you to create forms, workflows, webpages, entire applications for use in SharePoint. At some point if you're creating very complex workflows, you may need to have some code written and that will be written for you in Visual Studio. Now in earlier versions of SharePoint, I hit that need to code wall pretty early. But now, there's so much power built into SharePoint Designer that I create entire workflows and, and rarely have a need for Visual Studio. But know that it's here if you need it. And if you do need code, you can begin by completing as much of the workflow as you can in SharePoint Designer, then exporting that workflow so that it can be imported into Visual Studio.

Remember though that despite all of these tools, and you may have a number of them already, the only thing you will absolutely need in this course is some version of SharePoint 2013 and SharePoint Designer 2013. If you have these two tools, you will be able to create some amazing workflows.

Understanding Workflows

What's a Workflow?

A workflow is an organizational process that has a clear beginning, some sequential steps and then an end. And a workflow might sit at the very core of your business, like an order entry process or a shipping process, to send products to customers. Or it could serve more of a supporting role, like a process that allows employees to submit a time sheet or request time off for a vacation.

This workflow is a small simple workflow that was designed to allow an employee to apply to be part of a management training program.

This is one of those supporting workflows. In this workflow, the employee has an idea that they'd like to apply and they fill out a form and submit that form to their immediate supervisor. Perhaps they carried over and put it on their desk or maybe it's sent as an attachment to email. Perhaps its a form that's filled out online. After their supervisor decides whether or not they should accept the request, they forward this form to the HR department, and everyone who applies then is sent back an email indicating whether they were accepted or rejected for the program. So this is a very simple workflow.

Perhaps there's another step as well. For example, it might be that for some employees, or for some specific management training programs, the immediate supervisor's signature isn't always enough. Perhaps it needs to be sent on to management, moved up the chain, so to speak, and then moves along to HR, and employee notification. This is a case where a workflow has two different branches and a condition. Does this need to be approved by others, as well as some actions.

Workflows can also incorporate parallel branches. So here's a workflow that's a little bit more complex.

We have an employee creating a presentation that's going to be used at the company's annual meeting. In our first step we see the employee working away and creating the presentation, then they need to send it to the marketing department where it's going to be buffed up a little bit. That's all nice and clean. Now three different people need to sign off on this presentation before we're going to share it with our stock holders. We have the Chief Financial Officer, we have the Chief Operations Officer and the Chief Executive Officer, or CEOs. So all of the CXOs need to take a look at this. They don't need to do it in any particular order. And as a matter of fact, ordering these might actually create a bottleneck or a slow down because it could be that the Chief Financial Officer is out of town. And by the time we wait for him or her to finish their review, now the CEO has other obligations. So this is a time that it makes more sense to allow each of these reviews to happen at the same time, in parallel with each other. We need three signatures, but we don't need them in any particular order. Finally, after all three of our chief officers have signed off, the presentation is sent to the IT department, and they're going to post it on the webpage, so it will be available for the annual meeting.

Now, whether or not there are parallel branches in a workflow, every workflow goes through a series of steps. It has a start, a series of steps, and an end.

New to SharePoint 2013, we can actually create a workflow that would double back on itself. And it used to be that in the prior version of SharePoint, we could never back things up, we could never actually send them back, but in SharePoint 2013 we can. We have a new structure called the loop, that would allow us to say that if any of the three executives turn down this presentation, they send it back for more comment. We can actually have the workflow send it back either to the marketing or send it all the way back to the originator.

So when you think about workflows, the workflow is an outline of a business process that contains some way for users to interact, usually with forms, and logic that drives all the steps in between. We'll spend the rest of this course learning how to develop and build workflows in SharePoint.

Automating Workflows

Automating a workflow is in itself a workflow. There are a series of steps that you'll go through each time you create a SharePoint workflow. Whether it's a simple workflow or a complex workflow, this is a good habit to follow this series of steps.

First, you'll want to document the workflow actions and conditions. You want to capture the steps that will be taken in the workflow. Another way to think of this is, you're capturing requirements. If you're creating a workflow that you're the only user, it's still a good idea to do this. And I'll show you several ways that you can capture requirements, your actions and conditions for the workflow, using different tools that are part of the the Office Suite.

The second thing is you'll want to choose a workflow type. And there are a range of types. There are reusable workflows. There are site workflows. There are built-in workflows in SharePoint. And then there are also custom workflows which is where we'll spend most of our time in this course.

Once we've chosen a workflow type so we have a broad direction, now we want to create any of the custom SharePoint and InfoPath items that we need for this workflow. Sometimes all we need is a list. We have a workflow where a user adds some information to a list, a new membership, a new item in the inventory, and then we launch a workflow. We need to create that custom list. Perhaps we need a custom document library or maybe we need more information from the user. We're going to have them fill out a form. That form needs to be created. So, if you need custom forms, this is the time to create them, in InfoPath or perhaps with another tool. And if you need a custom list or a custom library, create it now in SharePoint.

With our customized list, libraries, and forms in place, we are ready to enter actions and conditions. If we're using one of the built-in SharePoint workflows, we'll do that in SharePoint. But most of the time we'll be doing this in SharePoint Designer. So we'll open Designer and we will articulate each of the steps, the different actions and conditions that form our workflow.

So we'll save that workflow and we will publish it in SharePoint, connecting it back to a particular library for example or a particular list.

And then finally, we'll test our workflow and make sure it works.

And when we've gotten to that point, we have a truly well-written, well-documented workflow that we've automated that we can turn loose on the rest of the organization so that everybody can take advantage of having their work automated.

Workflows and Tools

In this course, we're going to create a number of different workflows. Some of them are workflows that will solve relatively complex business problems, or workflows that may run for a series of days or weeks or even months. And then we'll create some smaller workflows that run quickly, that maybe take us only a few minutes to create, and a few more minutes to test. And then of course, a few more minutes to document. And so, we're going to create a number of different workflows. Some fast and easy, some more complex. Some that we will complete, some that we'll leave half finished, because we'll have learned what we need to learn out of the first five minutes with the workflow. And we'll use different tools to create them. I'd like to describe the geography and the tools for our time together.

Major workflows

First, employee onboarding. Any organization that hires new employees has to have a series of practices that they put in place to make sure that they're getting all of the forms filled out for the employee. But also to make sure that we've given that employee appropriate access to computer systems. An e-mail account perhaps an office maybe some technology whatever the process is. It's probably a process that in the early days of the business was fairly informal and as your business grows needs to be more and more formalized so we make sure that we cross all the Ts and dot all the Is. So this is the sequential series of actions that are related to new employees, employee onboarding.

In the same way we used to order business cards by picking up the phone. Calling down to the HR department or the print shop and saying, hey, it's Joe. I need more cards. When there are only 25 employees, that's not a bad thing. But when there are 2,500 or 25,000, you need process in place. And so this is the formalization of a process that allows an employee to order their own business cards, what's called employee self service.

In our organization when we need a new position, we have to go through an approval process for that. A manager or a supervisor or even a vice president or CEO will make a request. And then the person in charge of that department, whether that's a director or a vice president, has to approve it, but we also need approval from the chief financial officer. And the director of the HR area. So, this is an Approval Workflow that goes through multiple steps.

Minor Workflows

We're going to create a Workflow that simply confirms to someone who submitted a document, or a list item that, it was submitted. So we're going to e-mail em back and say, we've got it, we're working with it. We might also do a calculation, if that's appropriate, and send them a date that we would have something finished on. It doesn't matter. The whole idea here is, send an e-mail.

We're going to create an announcement from an item that was added to the calendar. And we won't do this automatically. Whenever a user enters something on the HR calendar. Will give them the ability to say yeah, I'd like that event put in the announcements list as well so creating a list item from another list.

Back in the day, we had filenames in Windows and before that in DOS where the disk operating system that were constrained to eight characters followed by a period and three more characters hard to believe when we're creating filenames today like "My Beautiful Report I Created on a Winter Day." But we used to have to just be able to describe in eight characters that same idea. And because of that, many organizations created maps for how they were using filenames. If you were saving a group of policies, for example, the first two digits might have been the policy's prefix. The next two might have been the policy area or department. When we only had eight characters to use, we were making sure that every one of them had meaning. Because, that's how we were storing our metadata. We still have file names like that. Even when users were told that they could use 256 characters in a file name, there were still lots of reasons to say, actually, we want to constrain that filename. Because we still had no place to put metadata, so we were still mapping. If you have a library full of policies, documents, time sheets, whatever they are where you've used that kind of practice. We can extract meta data from those file names and put them into columns, which is the appropriate thing to do in SharePoint.

We're going to create a minor workflow that allows us to process credit card transactions. This will pop up a couple of times in the course. We'll look at it early. And a little later on in another version and we really wouldn't be creating this kind of a workflow. This is the kind of thing that you have to buy insurance and fill out many, many forms to prove that you are appropriately protecting each and every transaction. And so today, most folks who want to process transactions aren't going to create their own workflow. They're going to purchase some kind of a service that is going to do this. Even if it's just a square that you plug into your iPhone. But it makes a great practice for us to learn something about how we work with choices.

We're going to create a workflow that's a site workflow available throughout the site, not tied to any list or library, to be able to quickly grab suggestions and feedback from users.

And we're going to create a workflow that authorizes a payroll that includes hours that are greater than 40 for an employee.

Those are our major and minor workflows, and a few others along the way that don't merit discussion or conversation here.

Workflow Development Tools

What tools will we use? Well, the first tool we'll use, and we'll use it only briefly, is Internet Explorer, to be able to create a workflow using the built in workflows in SharePoint. We don't even need SharePoint Designer to create workflows like the three state workflow. It, we'll see shortly.

But we're going to download and install SharePoint Designer 2013. This is the SharePoint designer central training course. And this is our workhorse. SharePoint designer has two different interfaces or two different designers built in. SharePoint designer is a free tool. And, the text based designer inside of it, is the free version of SharePoint Designer. Is one way to thing about it. Because, all you need is your SharePoint site and SharePoint Designer. And, you'd need a browser to be able to check things out. So, this is our development environment for most of this course.

However, there's also a visual designer that's available in SharePoint Designer 2013. The reason that this isn't what we spend most of the course working with is it's only enabled if you have Visio Professional installed on the same machine that you have SharePoint Designer installed on. SharePoint designer is free. Visio Professional is not. And so for many of us if we want to be able to quickly jump in and start learning hot to start creating workflows. Saying pleas send hundreds of dollars and buy me one more piece of software so I can do this visually is a pretty high bar in many of our organization. But if you have Visio Professional not only can you use the visual designer and share point designer but you can also create workflows right in Visio. You can't really finalize them there Visio does not have a way to publish these back to your SharePoint site. And they're many settings and specific options in commands that Visio cannot provide. However we can begin creating our workflow in Visio Professional. And then we can open it up in SharePoint Designer. And further customize it using the text based designer. Or obviously the visual designer. Because if we have Visio on our machine then we must be able to use the visual designer. It's possible though, that you have someone in your organization. A business analyst for example, who can use Visio to create the workflow that you need, to work with. You don't have Visio, but you can still open it and use it in the text-based designer.

So these are our workflow development tools that we will be using in this course. And the minor and major workflows that we will be creating together. I'm looking forward to our time together. Let's get started. We have a lot of things to design.

Documenting Workflows for Automation

Documenting a Workflow with Sticky Notes

Whenever you create a workflow in SharePoint the most important steps you will take, will be taken before you ever fire up SharePoint Designer. Before you ever visit the SharePoint site. It's the work of documenting your user's requirements for the workflow. What do they think needs to happen, and in what order? You'll most often be working with a process that already exists in the business. So you're automating an existing set of steps. And you'll find often, that that process has been customized by the people who participate in it. Manual workflows often have hidden processes where everybody knows what's going on but nobody talks about it. Or processes that people think they understand that they're not all that clear about. And so this is a good time for you to expose all the intricacies of whatever it is that you're going to automate, because when you're done, you actually want it to do the job.

For example, let's say you were talking about some kind of an application process and someone will say well, the application gets filled out and then it goes to Mary. So one way we could capture this, just a real quick little way, is we could capture it with a Post-it note. Or if you were sitting here with your computer you could capture it on a Sticky Note. There's my first sticky note. And so the user completes the application and gives it to Mary. That's our first step, right there.

And then our second step is, what does Mary do with it? Mary decides who it gets routed to. She makes a routing decision. So, now it's time to talk to Mary. And we might find that she routes it because, when she receives this, she needs to go ask somebody else. She's not even the person who gets to make this decision. Or you might find that she routes it to a specific department or a specific individual. And she's got a decision. But it might be that, that her role is simply to take this and send it to the same person every time, there really isn't a decision.

We want to know exactly what's going on here, because if Mary just receiving this for no good reason, then it might make sense to have somebody else receive it. It would make Mary a happier person. So Mary makes a routing decision. And then the application is routed to the appropriate manager. Because this is a decision, I'm going to turn Post-it green.

And that shows the difference between an action and a condition. Mary makes a decision based on the condition. And she makes a routing decision. And it's that manufacturing apps go to manufacturing. Other apps to HR.

So she's going to route this to the appropriate manager, either HR or manufacturing. I could continue adding notes to this, capturing all of them. Notice that you have a number of colors, you have blue, green, pink, purple, white, and yellow. And I could have done all this on piece of paper, or I could do all of this on a whiteboard if I was sitting with a group of users. But I actually like Sticky Notes, whether they are Sticky Notes like this or physical sticky notes. And the benefit of Sticky Notes, is if you have steps that come up later, you're not erasing a whiteboard. It's very easy to just move this over and say, oh, we have another step, and it needs to go in here. Because, actually, it doesn't go to Mary first. The user completes the application, and they give that application to the front desk. And the front desk routes the application to Mary.

This is one way to capture information and to be able to move it around. I can take a picture of this using the Windows screen scraping utility if I want. Just grab it. If I do this with Post-it notes, and I have them on a wall, I'll often take photos with a camera so that I am capturing this information accurately, you can also take the Post-it notes off the wall and put them on pieces of newsprint or butcher paper, so that you have a way of capturing it all together in one place.

But if I wanted to just take a picture of it, in the same place that Sticky Notes are kept, which is in Accessories. There's a thing called the Snipping Tool, and this is a new Snipping Tool and it says select the window you want to capture. And, there's that entire picture. And if you're using this all the time, of course, you're simply going to add the Snipping Tool to your Start Menu, so that you can get to it very easily. I can say I'd like to create a Rectangular Snip and it says, drag around the area.

This is one way to capture information, electronic Sticky Notes, physical Sticky Notes. If you have a complex process and you have a lot of things going back and forth. And you believe that there's not general agreement about the process, then something that allows your users to physically move notes around, or watch you do it, is a very good choice of one way to initially capture user input about your workflow process.

Using Excel to Document Workflow Design

Even if I'm using some kind of sticky notes to be able to engage users in discussing their work flow, I'm going to capture my requirements in a more formal tool. And Microsoft Excel is a great application for capturing lots of information about business processes and business analytics.

I've included a worksheet that's a version of the one I use in our exercise files. It's called work flow requirements. I'm simply going to open that up. This work book has two sheets.

The first allows me to capture the same kinds of things that I captured in sticky notes.

It says WorkFlow Actions and Conditions, but I'll be abstracting my actions and conditions from the descriptions on information that I enter here.

And I also have a tab for stakeholders.

The reason that I like having this second worksheet is, as we are going through a workflow that has a lot of different players and a lot of different steps. It's not uncommon for someone to say, oh you should go talk to so and so in the warehouse about this. And rather than jot that someplace else that I'll lose it, I'll simply make a note here that I need to talk to Joe Green who works in the warehouse and what I need to talk to him about, and it's all in this same workbook together then.

I can also add a date column here and know when I actually interview people. Although many times I'll be talking to someone more than once. And a calendar is a better place to do that. But, you could keep track of when you actually spoke to people on this stake holder worksheet as well.

So, let's go back to that work flow. Our very first step, is that we have users completing an application and submits to Front Desk. And the actual action person here is the Front Desk. And there is a specific form that's being used. The name of that form is EmplApp2.docx. So that's the name of the form because somebody has it and I've asked them now to send me an electronic version. Let's say that Carol will email soft copy of form. I enter that into the Notes column. Later I'll fill in the actual actions and conditions that I need to have but right now, all I need to do is capture information for my user.

The front desk then sends completed app to Mary. Front desk, the form that's being sent is the same. Easy to copy using control quote, by the way, or you can use the floor handle, and I want to make a note here that Mary works in HR. And the reason I want to make a note about that is, that there are many people named Mary in the company, but the other thing is that this is actually an HR function and I want to capture that at this point.

Mary makes a routing decision. And this is Mary who's the HR intake person. It's the same form that's being used, but. At this point, this is a decision and so, what we've captured from her when we talked to her is that manufacturing apps go to manufacturing manager all other apps to HR manager. Don't spend a lot of time determining whether you could combine things into multiple steps, it's sort of better to break it out so that you have the actual action apart from the decision. We can combine those later.

So, she makes the routing decision as she emails the app to the appropriate manager. And this is Mary doing this as well. So we have one form that being used all the way through this. Probably, this form doesn't get written on when she makes a decision, but it does get noted when she emails it. But let's just take this same form all the way down, that's fine. Looks good and we've now captured this set of requirements.

We might now want to go talk to the manufacturing manager and the HR manager and see what they do next or we might decide that our entire workflow was simply getting this user's application to the correct person. And once that's done, then we don't need to do anything more with this workflow. These are the requirements that we are going to keep here.

There's a place here for you to fill in the workflow name. And so this is to route applications for employment. And now that I've put my work flow name in here for now, I would go a head and save this so that I would have access to it later on. So, this is how we'd use Excel to be able to capture some requirements. We'll come back to this workbook later on in the course. But if you're out documenting workflows, this is again, a great way to do it.

Remember that you don't have to choose just one tool. If you work with a lot of Excel users, they may be just fine. With using Excel as the method to capture their input. If people are not as used to Excel, you might be better off with a sticky note. You don't have to choose one tool for everything and you don't need to restrict yourself to only one tool in a workflow. You'll just want to make sure you keep all of your information together.

Using Visio to Document Workflow Design

The very best tool, the most appropriate tool that you can use to document your workflows is Microsoft Visio. Visio was designed to diagram processes, to diagram layouts. You may already have Visio on your computer. If you don't have Visio, you'll have to buy Visio. You can either purchase Visio Standard, but if you're going to be doing SharePoint workflows, you should go ahead and purchase Visio Professional because it's designed to work with SharePoint. If you do have Visio, you'll find it in the Microsoft Office group. Go ahead and open Microsoft Visio. This is what is looks like when you open it.

I'm going to click Flowchart because that's what I want to make is a flow.

And you'll see here, all the different built-in templates for flowcharts. If your users are used to basic flowcharts that are used for program steps in programming, that will work. If they're used to cross functional flow charts though, I would choose cross functional before I'd choose a basic flow chart. Because, here in a cross functional flow chart, these different lanes or what are often called swim lanes, represent different departments or different people, different actors in your work flow. And so it's easy for you to be able to see that you have all these actions being done, for example, by the Front Desk, and actions being done by Mary. So, if your users are used either one, I would move to a cross-functional flow chart. If we scroll down a bit, what you'll see, is we have the ability here to do a Microsoft SharePoint workflow. We have a workflow diagram and a 3D workflow diagram. And you might have noticed that all of these icons as we scroll down look different and that's because they've been redesigned for this particular version of Microsoft Office, including Visio, so welcome to the 2013 icons.

I'm going to choose Work Flow Diagram in U.S units and click Create.

I would highly recommend if you are new to Visio that you take a look at one of the courses on Visio. This is not the most intuitive tool. You can either learn how to use it well, even at a basic level, or you can struggle with it a lot.

What we have, are we have a series of stencils. We we're seeing here our work flow steps, work flow objects, names of different departments, you'll begin to see how this is going to be cool. Different arrow shapes and so on, so this is, this is a workflow.

This is not a workflow that we can take directly into SharePoint, but it's a pretty cool workflow.

We start with the user, we're just going to drag the user out here. And the user is going to fill out a form. Now, I have document there, I can scroll down and see if I have form. These are neatly in alphabetical order for me. So, I don't. So, we'll just have a user filling out a form. Notice as I move this, it wants to help me center it, or align it. We'll just have all of our items aligned here. We're going to have somebody at the Front Desk. That might be a department. It's actually a receiving department. Reception works well. So, we're going to have the user turn this into reception and then we're going to take that same document and it's going to be sent over to Mary, so that she can determine where it goes next. And Mary works in HR. So the document goes from the Front Desk, to HR. And then Mary sends it to one or two places. She sends it to the manager up in manufacturing. Or, she sends it to the manager who's in HR. Now, Mary works in HR and we have a manager who works in HR, so we might want to represent Mary with a symbol other than HR, like a person symbol, so it's not confusing. We have just a person that we can use here. And if you scroll down to the bottom of, many of these different areas. Departments, steps and so on. You'll see that we have a lot of different things we can choose from.

Now, in terms of steps we also have a Start we could put out here. I'm actually going to select everybody else and just scoot them to the right a little bit so that our step fits on the same page. And now we have an End.

The Document. Being submitted to reception, being sent to Mary, going to manufacturing, or going to HR and we're all done. Now we also have the ability to connect these items with arrows and so on. Notice that when you encircle or lasso items, if you don't get all of something. It's not included, so that makes this a little bit easier. And I can either use arrows here, in order to show movement. For example, if I want to show that this was a process that was going from the left to right. I could do a simple arrow for example, here. Drag this on the page, turn it at 180 degrees.

But if I want to connect the shapes, I'm going to use a connector, and that's right here. So when I choose Connector, I can click on one shape and connect it to another, very easily. Just by dragging. So, I can drag from this green handle to this green handle, and that connects these two shapes. It will work really hard to be able to glue this to a connection point for me. If you make a mistake and you go backwards, it'll try to make it go backwards, just do an undo. And do that again. Grab this shape, drag it to that one. This one, drag it here.

Now it would be nice if I could actually show a decision being made, and we'll do that with some text. So, that's one possibility, and this is our other possibility, and if I want to type text any place here, it's very easy for me to do. Remember that you have a zoom slider just like you would have if you were in Excel or somewhere else, so we can make this a little bit bigger if we would like. And if I want to type text I can just click wherever I'd like to type the text, and type. So, if I wanted to capture for example, Mary determines routing I could do that here. If I want to scroll back and say, that, here the user, completes app, over here. I want to say, Front Desk sends to Mary, and so on. So, this is how we attach text to our different shapes.

And we have one more step that we need to do here. So we'll go back to our connector one more time. Because, whether we go to manufacturing or we go to HR, ultimately this will come back and our process will end here.

So this is how we can use this set of diagramming tools to create a really nice looking workflow here in Visio that we can share with our users. We can have this conversation with them and say okay, so this is what we see happening here. Is that what makes sense to you? We can move any of these items that we want so that they do a better job describing for us, makes it easier to see. If you don't like the colors, you can, of course, go in and you can change the design. This is simply one design. If you wanted something that was more fitting with your organization. Any of these will do, as well. And I'd like to just slide this back just a little bit so that we can get a slightly better arrow here. There we go. And then we'll resize this one to be approximately the same size. Our start and our end-point. Looks good.

So, we've used Microsoft Visio 2013 to be able to capture some requirements in a way that our users will find easy to understand.

One more thing that you might want to know about this. We're very close to being able to create a workflow that we could simply throw into SharePoint Designer. So, we'll be returning to Visio later in the course to look at this workflow again, if you created it in Visio go ahead and save it, so that we have it later on for our reference.

Driving Workflow Interactions with Forms

The majority of workflows are actually composed of two different types of artifacts. First, the logic of the workflow, which we have documented using Excel or sticky notes, or Visio, and that we'll build using SharePoint designer. And then the forums we'll use to interact with users, whether we're presenting data to them or trying to capture information.

You'll see two different types of forms that are used in SharePoint workflows. One type are forms that are created in Visual Studio, and we won't be creating Visual Studio or .aspx web forms here. The second are forms that have been created using InfoPath Designer 2013.

Here's an example of an InfoPath Designer form that we will be using later for our approval process for request for time off.

So this form allows users to fill in information by typing, by clicking and choosing from drop-down list boxes, using date pickers, and so on. And so we'll use this form to capture our users' information and also to capture approvals or non approvals from managers and vice presidents on up the chain.

So this is what an InfoPath form looks like when we create it from scratch and InfoPath Designer. But SharePoint creating info path forms all the time. I'm going to switch over to the SharePoint site that I'll be using to create my workflows. And here we are in a basic tasks list. I'll show you more about this site later on, but this is the Internet for No Obstacles Incorporated. And if I wanted to create a new task, for example I just say, you know let me see a new item. There's a form that gets presented to me. It has a place that I can type text. It has drop down lists. And calendar controls that I can use much like the form that we just saw. And there's a reason for that. Like the form that we just saw, this form is actually created using InfoPath. And so I can edit this form using InfoPath as well. Any type of form that's attached to a list is easy for me to edit. If I want to know that's true for sure, I can just go to list here on the ribbon and notice that when I customize the form I would be using Microsoft InfoPath to do that.

Depending on your environment, you will be creating workflows that have a greater or lesser need for forms. But if you're going to create forms at all, then you'll want to know something more about InfoPath Designer.

Running a Built-In SharePoint Workflow

Exploring the Three-State Workflow

The Three state workflow, or three phase workflow has been with us for the past few versions of sharepoint, and it appears in every flavour of Microsoft SharePoint 2013, from SharePoint Foundation, to SharePoint Server Enterprise, to SharePoint Online. A three state workflow is frequently used because it's included by default. It has its own interface in SharePoint, so you don't need to install any other software to use it. And it's relatively easy to use. Now, first, you have to identify your three states. For example, it might be that you have a library. And an item has been submitted. And then it's been reviewed, and finally it's been approved. Three states. One, two, three. Or perhaps we have an item that's a drat deliverable, that has then been peer reviewed and is now finalized. The three state workflow we're going to work with will have these states, that are used in the Issues list in SharePoint. An issue is active. Then it’s been resolved. And the person who reported it has checked it and closed it. So, we're going to be creating a workflow and setting options using an issue’s list. If you need more than three states, this is not your work flow. And if you need less than three states, this is not your workflow. This is for exactly three states. But the three state workflow will give us a good idea of how to use all of the built in workflows that you may have, in whatever version of Microsoft Sharepoint you're using. So, let's begin by opening the list that we want to put this workflow into. Here's the issues list. It has one item from a while ago. And the reason that we talk about it as having three states is that when an issue is added to the list, it starts out as active. It then has been resolved and finally closed. So those are the three states that are here on this workflow. I want to open the form so that you actually see how this works. When an item is added it's assigned to someone and it's marked as active, that's just the default. And the user can give it a priority, there's a description. There's also a category list here by the way that has three things on it. So you could use these categories in a three stage workflow, but they're not really stages, they're more descriptors, and you could have five or 12 of them or whatever. So when this item has been added, then we have an entire form, we have a place for a description. And then, when someone's working on it to fix it there's a place for comments. And all of the comments that are entered get tracked and recorded here. Now that we understand a little bit about how this list works, let's go ahead and add a work flow. So, I'm going not click the list tab on the ribbon. I'm going to go to work flow settings, and I want to choose edit work flow. Not create a work flow in SharePoint Designer, that's starting from scratch. We're going to go there next. But, to add another work flow using the work flows already built into SharePoint. We have two workflows available to us right now. You may have more. There are more than two workflows that are available depending on what's installed on your version of Sharepoint server. If you're working with Sharepoint foundation, at any point, you may only have the three stage workflow, you won't even have disposition approval. But there's our three state workflow right here. And I need to give it a unique name. Now this is running out of SharePoint 2010 templates. That's fine, that workflow engine is available to us here in SharePoint. We actually have two SharePoints engines in 2013. We have the SharePoint 2013 engine and the SharePoint 2010 engine. So I'm going to enter a unique name for this workflow. And I'm going to call this issue tracking. Then there are two possibilities of where I might want to put the tasks that are generated by this workflow and any history that gets kept by the workflow. There is already a built in tasks list and a built in work flow history list so I'm just going to keep those defaults for now. I'd need a compelling reason not to hang onto the defaults here. The next section, start options, have the settings to indicate how this work flow will start. By default, every single work flow we create has one choice and one choice only turned on, and that is allow this work flow to be manually started by a user who has appropriate permissions. Actually, I'm going to say whenever there's a new item we want to start this workflow, because I want this to be automatic. I create an issue, and I want the workflow to begin. Now I can turn off manually started and just say, the only way this starts is when there's a new item created for a workflow, so that will work. If I choose this first option and really the about the only person who's going to be able to go in and start a work flow is a list manager, so it doesn't make it available and useful for every single user who could actually add something to the issues list. And remember that if I use a lot of this workflow to be manually started, and I don't include creating a new item will start the workflow. That, what I've done is I've created something automated. But then required a human being to provide some intervention in order to start it. I'm, I'm not sure that I'm ahead. It's certainly not automatic anymore. If I have to have a list manager come start the workflow. So, create a new item will start it, I'm going to click Next, and here are our workflow states. The first thing that I have to do is I, I have to choose a field. And remember that we had Issue status and I also showed you that category was sitting there and there's a priority field for high, medium and low. But issue status is actually what's baked in. And notice that these are the states I showed you. Active, resolved, and closed. So those are the three states that we're going to move through. They're not in alphabetical order. This issues list is actually pretty workflow aware. It was designed for this, so active is one, resolved is two, and closed is three. Because that's already selected issue status, these values are also already filled in for me. If I had chosen, for example, the priority list, then I'd have to choose what the states were here. But as long as I just keep the default of issue status, we're in great shape. And now I need to specify what the steps are in my workflow. The first item is there's a custom message that says workflow initiated and then I can include a field out of my list title is actually the field that's the name of the issue so that's a great one to use. So, I can include title as my list field. I can include assign-to or something else, but this is mostly built out for me. So, work flow initiated for this item, and it's going to grab the title here. So, in the example that we saw, the only item that's there, it's to add a logo, so it's a work flow initiated Add logo. And then what we see here under task details, includes also then the description, there's a custom message. And the custom message says the workflow has been initiated on the following list item. And it includes a description and it will include a link that the user can click on to get back to that item. It will also say that this has a due date. I could choose a different list field. And it will include who this item has been assigned to. So, these are all of the default settings. Send an email message to the person that it was assigned to, use the task title for the subject, include a link in the body. Notice, we're just looking at this. I don't even have to do anything with it. All of these choices seem very formulaic, and if you're just starting with workflows you might think, oh there's a lot here to choose from, this is really confusing. But if we're doing an issues list for example, all the choices that we want are the correct choices and they're already entered here. So we're really, really using this to be able to learn how this workflow works. So after the first state, we change to the middle state. Now how that middle state is going to happen, how were going to get from active to completed, is the person this task was assigned to is going to say, I believe I've completed this. So our second section, and picture a large horizontal line, that it would be nice if it was on the screen, so this, okay, so what happens when the workflow changes to its middle state. So an issue, in the issues list, changes the resolved state. It creates a new task for the assigned user. And the task is, go back and review this item to make sure that it is okay. So somebody put an issue in. We need a logo on the site. I say I've done this so now the email goes to the person who submitted this saying hey the person this was assigned to says thast they have done it and it will say a review task has been created go see if the work has been done properly. There's a due date includes who it was created by and here's all of the information about our message. That looks great. Now you might wonder, well why aren't there emails or other things for state three? Well, when we get to the third state, or the n state in our work flow, all that happens is the person who reviews it says, yep it's fine and it's closed. It's all done. So there are no details for that state other than simply saying that we are no longer in the review state. We've got it. There's our work flow. I'm going to click okay. So we've come back to our list, I would think, wow did I even do anything? Yes, we did because we've actually added one more column, this is the column that's going to track the progress of our workflow and it was automatically added to our list. By SharePoint. We don't get a choice to say we don't want this. When we add a workflow the workflow itself gets a column to be able to reflect whats going on in the workflow back to the users, and folks like you and I. In the next movie then we'll see how it looks when we actually use our workflow by adding a new item to our issues list.

Running the Three-State Workflow

I have an Issues list here in my SharePoint site for the HR group, and I've added a three-state workflow to the list to be able to automate my issue tracking. So, this is actually the issues for the work on the SharePoint site. So, one of the issues was to replace a logo, for example. Here's how, this issue piece is expected to work. A user adds a new issue to the list. There's an email that's sent to the person that's assigned to, to resolve it. That person does some work, maybe some research, fixes it and says, I believe this is resolved. An email then is sent to the original requester, the person who entered the item on to the list. To say, okay, the person you assigned it to thinks they're done, what do you think? And then they go in and say, yep, this is fine, and they close the issue. Let's see how this works. So, I'm going to say that the title of this issue is that we a higher resolution logo needed on the site. We're going to assign this to someone and I'm actually going to assign it to me so that you can see how this all works. By default, it's active cause it just got here. And, I'm going to say, that the logo that was used is only 300 dpi. We need a higher res logo. 300 might actually be enough. Perhaps it's even worse than that. This is actually related to this issue, so I can add that as related. That's just some background some other information so somebody can go see other efforts that have been made to resolve a issue that was similar or related. If you don't customize this category list, it's only really good for hurricanes categories one, two and three. It's not good for anything else. Normally an issues list, you'll figure out what kind of categories you want to collect and don't simply say, well, we say category one when we mean this. This isn't the same as priority, that's up here, high, medium and low. So, you'll want to actually to modify this in SharePoint, for example if we were working on a site. There might be something about, it's a content issue, it's a user interface issue. It's a workflow issue, those kinds of things. For right now, we'll just leave it as it sets. And we'd like to have this resolved before the holiday, so let's choose the 20th. Say we'd like it done by two o'clock in the afternoon, and save it. Now as a result of my having placed this item here and assigned it to someone, when this workflow get running, which it is, it's going to send a couple of emails. Here we go. Workflow initiated, higher res logo needed on the site. And here we have what's called an absolute URL. It's the full URL. It's not relative to anything else or my position in the site. It doesn't matter who I send this to when they click. If they have permission to the site, it's going to take them back to this item. So now I can look at it, all I got really was the title, it says okay. It's a normal priority alright. Okay we need a higher res logo and it's related to the replace logo item, so I can click here and see what the replace logo item is about. That makes sense, I'm going to go back, now. So, what I do is I would go to the folks in the marketing or the PR area and say I need a logo with a better resolution and they would give me one and I would then go ahead and put that on the site and I'd say okay, I'm done. So, now I'm going to make a comment. So that the person who submitted this issue, me in this case, but not normally me, is going to know what was done. So, I obtained a high res logo file from marketing and posted it on the site. That's done. And here's the important piece, I have to rotate this from active to resolved. I believe I've resolved this. Click Save. Now, notice when we go back to our list. We have this issue tracking workflow running. I didn't have to do anything to add this column. I also can't prevent this column being added. It's here because I have a workflow on this site, so it was automatically added. Here comes the email from the site, from human resources that says. Review the task, higher res logo needed on site. So now, this is being sent back to me as the person who added this item to the issue list. I can click, go back and see that there were comments made about how this was done. We're all good. I would now go out to the site and see, yup, I like that. That's a better logo, that's exactly what we needed. And I would then mark this as closed. There's my third state. There's nothing here that goes back to the person who actually did the work. And that, to me, is one of the disadvantages of this three-state workflow. Because I think it's just super at this point to be able to send a thank you note. So a four state workflow would make me happier. Where the fourth state is a state of gratitude. You can send an email to the person because you have the ability to actually click and go find them, if you wish. You can go right to their site, and you could leave a note here. You could create a post and mention them, so there are lots of different ways that we could be grateful to someone. But the gratitude is, is not present unless you and I put it there. So I'm going to agree that this isn't just resolved. This item is closed. I could make a comment that says, thanks so much. Thanks, great work. Now at the bottom here it says Gini, Gini, Gini, so it, it seems like. It's all me. But it would make sense when it's a conversation where it's Gerald having put the item on the issue list and Mark having fixed it and then Gerald saying great work. And you get to see that as a dialogue. So, this item now is closed. If I refresh my page, the issue tracking will show this workflow is completed. By the way, whenever you see the information in the tracking column for a workflow, that's actually a hyperlink. And you can go see how that workflow operated. When it was initiated, related content and all of the different events that happened because this three-state work flow rights to the work flow history, whenever it sends an email. So the workflow was initiated, items were being completed and notice that there's a, a little bit more drag on my system, that I'm just now seeing my desktop alerts for the emails that I've already received and worked on. But it's easy to go see what happened in the workflow, and that's a great thing. So, if you have three states, we've got a workflow for you. But if you have one state or two states or 27 states, we're going to create custom workflows. And that's what we're going to be doing in all of the rest of the movies in SharePoint Designer 2013 custom workflows.

Getting Started with SharePoint Designer

Installing SharePoint Designer

Before you can use SharePoint Designer 2013, you will probably need to download and install it. SharePoint Designer is a free download from Microsoft. Simply go to Google and enter Sharepoint Designer 2013 as your search term. And the very first site that will come up at the top is download.

I can choose download SharePoint Designer. I can get some Details about it. There are multiple files available for this download, and that's important to know because there are actually two versions here, as well as versions in different languages. So I want English.

I want to make sure that the version that I'm downloading matches up with Microsoft Office. The choice of 32-bit or 64-bit SharePoint Designer isn't based on the capacity of your machine and it isn't based on the Windows version you've installed. What you need to do is choose the SharePoint Designer version that matches the version of Microsoft Office installed on your computer. So, my computer is a 64-bit machine running 64-bit Windows, but I'm running 32-bit Office, so I would choose SharePoint Designer 32-bit exe, and choose Next.

And then I will be prompted to either Run this or Save it, and then I can run it after I save it.

SharePoint Designer itself is also specific to the version of SharePoint. So, if you are running SharePoint Server 2013, you need SharePoint Designer 2013, not SharePoint Designer 2010 or 2007.

Opening a SharePoint Site, List or Library

I'd like to open this particular site in SharePoint Designer. So I'm going to begin by starting SharePoint Designer. I'll go to the Start menu, and All Programs and in the Microsoft Office group, or if you have more than one version of Office, the Office 2013 group. Look for SharePoint Designer 2013. If you do not find it here, it is sometimes installed in a group that's called SharePoint. But I'm going to open it right here. And if this is the very first time the software has been launched on your computer, you may be prompted, would you like to open a site, or customize a site, or create a new site. You can do all three of those things. I've had this open before, so I'm simply going to click on Open Site, and it wants to know where my site is. Now a moment ago, I was on my site, so let's go back there, and this is the URL or address for the site, notice I'm on the human resources site. The end of the URL from my point of view, the name of the site ends right there with HR. The remainder of the URL, is telling me how this site is laid out and what this page looks like. But this is the information about the site, so I can just select that and copy it. I could also write it down and go type it again if I wish. Go back to SharePoint Designer, and we're going to paste that in the Site name, and click Open.

SharePoint Designer is retrieving information from the SharePoint Server about this site. And because I'm logged in, it can find me, and I'm not prompted to enter my user name or account information. Now, sometimes I will be prompted to login, and you may be prompted in one of two different ways. You may be asked if you want to login, or if you want to use a different account. You might wonder, why would I use a different account? Well, for example you may be logged into Windows as a user, as yourself. But have a separate account that you've been given to do development work in SharePoint. And if so you would choose another account. If your prompted to enter credentials more than once that's fine. Don't let it bother you it's relatively normal. It depends on your environment and how you connect to SharePoint Server, but you know you are connected, when you could see the title for your site, Human resources and the description. The permissions for this site here.

This is what your site looks like through the lens of SharePoint Designer. It's a site that has list and libraries. Can have Workflow, Site Pages, Site Assets, and so on.

Now I'm going to close this site. The next time I want to open this site, I can find that site right here on my Recent Sites list. So, all of the sites that you've previously opened in SharePoint Designer will be here, and all you have to do is click to open them. And, if you're prompted, provide your username and password to get into the site.

Now I don't have to open SharePoint Designer in this way. I can open it also from SharePoint based on the particular activity that I want to do in SharePoint Designer. I'm going to close SharePoint Designer. I'm back in my site. In my site if I wanted to create a workflow, for example, if I wanted to go to my Documents library and create a workflow using SharePoint Designer, I could click the Library tab in the ribbon, at the far right go to Workflow Settings and say, I'd like to create a Workflow in SharePoint Designer. Internet Explorer asks, is it okay, to have a website open a program. Because right now, SharePoint is trying to open SharePoint Designer through Internet Explorer. So I'm going to click Allow, now the security program in Internet Explorer wants to ask me again, Are you sure? And I'm going to say, Yes, please allow. And notice that it's opening up SharePoint Designer with the site that I launched SharePoint Designer from, ready to create a workflow.

So two different ways that I can launch SharePoint Designer. One I can simply start it as an application and connect to a particular site I want to work on. Or starting in the site, I can launch SharePoint Designer. Either way, we now have the ability to work in this SharePoint site using SharePoint Designer 2013.

Using Workflow Actions

Understanding Workflow Types and Permissions

In earlier versions of SharePoint, like SharePoint 2007, there was really only one type of workflow that you could create. And that type of workflow was called a list workflow. A list workflow is tied to a particualr list or a library. And it acts on documents or items that have been saved or dropped in those libraries or lists. This type of workflow is the standard bread and butter workflow. The last version of SharePoint, SharePoint 2010, added two new types of workflows: a reusable workflow, which is exactly what it sounds like, a workflow that I can use in more than one list or library. And a site workflow, which isn't tied to a list or library at all, but rather is tied directly to a site. We will be looking at all three types of workflows in this course.

And you'll see all three of them up here on the ribbon in SharePoint Designer.

These workflows have different types of permissions as well.

If you have a list or a library workflow, you just need to have design permissions for the particular list or library that that workflow is in so that you can publish and use the workflow.

But if you want to be able to create workflows that use content types, which is one way to create a reusable workflow, or to create site workflows, you need to have design permissions for the entire site. And that makes sense, because content type and site workflows aren't tied to a specific list or library. If you're working in an environment where a site administrator or a site owner other than yourself created the SharePoint site that you're going to be using, you may need to go back and ask them to amp up your permissions a little bit so that you can create the reusable or content type work flows and site workflows that we'll get to later on in this course.

Each of these types of workflows has a different use. And I think you'll enjoy seeing how each of them is created. So make sure that you have adequate permissions to be able to create all three types.

Understanding Events That Start Workflows

I'm going to quickly begin the process of creating a workflow so that I can show you some options for how workflows actually run. I'm going to click Workflows and then List Workflow.

I need to choose the list that I want to associate it with. I'm just going to choose the Documents library.

And we're going to call this a Sample Workflow. I could add some notes like this is just for testing and so on.

This opens the interface, but what I'd like to do is, actually get out of the designer and go back to the sample workflow by clicking on the Sample Workflow link.

Look at the start options.

There are three different options for starting a workflow.

The first option, which is the default, is to Allow this workflow to be manually started. We're going to use this method whenever it's necessary for a human being to determine whether or not to start the workflow. For example, in a document library, you may give a set of users or many users the ability to determine that it's time to review a document, because it may be obsolete or hasn't been modified in a reasonable period of time. We want the user to be able to select that item, right-click, and kick off a workflow to begin a review process.

The second option, Start workflow automatically when an item is created is the most used start option of these three. It's used any time you have a process that begins by someone filling out a form or saving a document. And if you think about manual business processes, that's how many of them start. You walk into an office, fill out a form, drop it off and that begins the process of interviews or interventions, whatever that form begins.

The third possibility is Start workflow when an item is changed. An example of that is a set of documents in a library, that whenever someone changes a document, there's a need for someone else to review the changes and approve them.

You'll find these settings right here in the overall settings for the work flow. It's not unusual to have more than one of these options selected. For example, I might say that I want to automatically start my sample work flow whenever a new item is created, a new item in this library, but I'm also willing to allow a user manually start this process. Or I could say, any time a document is created or a document is changed, I'd like to make sure that this workflow starts. Bear in mind that in any particular library, you may have muliple workflows. You might have one workflow that starts when a new item is created, and a document saved here.

You might have a review workflow that runs only when an item has been changed. And then you may have an archiving workflow that's a manual process. For each workflow though, you need to decide, is it going to start automatically. If so, is it going to start on a creation or on a modification and do we always want to allow the user to be able to manually start that workflow anyway. These are the three ways to start a workflow in SharePoint Designer.

Understanding Stages and Steps

SharePoint Designer gives us two tools to be able to organize our workflow, so that we don't have just a series of one action after another.

One way to organize is by using steps, and then we can bundle steps together into stages. One of the workflows that we're going to create is for a review and approval process. We could use this for approving a new hire or a new position, we could use this for approving time off or a major expenditure. These types of approval workflows are very common in business, so we create a lot of them.

In this particular case, we're going to first ask the area vice president to review and approve, for example, an expenditure. And the actions that we'll take are to email that vice president that they need to review this. To wait for a response back. If it's approved then, to email the submitter and let them know it's been approved and then to move onto the finance VP to do the same kind of review.

If it was rejected, then we'll email the submitter and then we'll end the workflow. We're not going to bother Finance Vice President if the area VP has already said no.

In the same way, we're going to email the Finance Vice President, wait for her or his response. Check to see if it was approved. Email the submitter about the status and if it was approved, move on then to the Vice President who sees it next, in this case the Human Resources or HR Vice President.

We could organize this then in two different ways. One way would be to say that we're going to have one large stage and all of these items would be steps but that's not the best way. The best way to organize this is to see that we have three different types of activities that we're going through, three different stages. The first stage is everything associated with the first vice president's review and approval. The second stage is the finance VP, and the third is the HR VP.

There's nothing for you build here, and you don't have this workflow yet. You'll be building it later. So let's just look at how this type of structure is created when we build it in SharePoint Designer.

Here are our three stages. The first is the area VP review.

The second stage is the finance VP review. And the third is the HR VP review. Now I haven't built the second or third stages. And again, all I'm doing is creating stages, steps within the stages and stubbing in the actions. We can build this later. This just gives us an idea of how we would build it and how it would look.

The reason that we like stages here is that stages are a box that has one way in and one way out. So in this case, we enter the stage and we do a step. And the first step is that we email the area VP, but there are two actions in here. There's the step where we're emailing, and the step where we're waiting. All of that is under the common step of email area VP.

And then, we transition out of this stage. So this is one way out. We check to see what the value of a field called approved is. And if the area VP approved it, and it's true, then we go to the next stage. And this is where stages become important. Because, as I'm leaving here, I have a choice to go to any of the stages or the end of the workflow. So notice that if it's approved I want to go see the finance VP next in my workflow and that's what I do. If it was not approved, we simply want to end the workflow. So this is the benefit of a stage, is it's one big container that we put a series of steps or actions into. We wouldn't have to even use the steps to organize. We could just say, email the users, wait, and once we've done that, then how do we leave this stage and go to the next one? By looking at the value of the approve field to see if the vice president approved it.

Each one of these stages is going to have similar actions and steps in it, and then at the very end we have the ability to end the workflow of course, because we've run out of actions to take. And that's how workflows will typically end, if we don't choose to end them in a way like this by saying well, it wasn't approved, we're all done.

Steps always go within stages. You can't have stages within steps. So there is a hierarchy here. And when I want to add new stages or new steps, I will simply make sure that I'm not in a stage. If I'm between two stages I can add a stage. Here from my ribbon. And if I am within a stage, I can then add a step or a loop, which we'll talk about later. When I'm transitioning, it also says I would use conditions and here are my conditions. And here are my actions, so there are the parts and pieces. Stages that hold steps, optionally, which hold actions or conditions and this is how we'll create a workflow and why stages and steps are important in SharePoint Designer.

Understanding Workflow Actions

We create SharePoint workflows because we want SharePoint to take an action or a set of actions on our behalf. SharePoint has a huge inventory of actions that we can incorporate into our workflows, and those actions are organized into categories based on their use.

The category names are pretty logical. For example, actions that affect the behavior of an item on a list are in the category List actions. We also have Core actions. The actions that are used over and over again that form the core of the activities that we might do in a work flow. We have Task actions that effect tasks. And Utility actions. You can think of like a utility hitter in baseball. They are mop up actions. But one of them allows us to subtract one date from another, so it's incredibly useful. We also have Coordination actions, and this category is new in SharePoint 2013. We will see these action categories all the time, but then there are other action categories that we only see at specific times based on a context. For example, the Document Set actions are only available for workflows that are associated with a specific document content type. Task Behavior actions only appear when we are customizing tasks in some of the SharePoint Enterprise server pre-built workflows, such as Start approval process, or Start feedback process. We're going to be using the List actions and the Core actions right away, and then work our way up to the Task and Utility actions.

So, let's see where we find all these actions in SharePoint Designer and how we would use them. Here we are in SharePoint Designer in our sample workflow that we're looking at to see how we use SharePoint Designer as a tool. And if we look at stage one, there are two different ways that we can enter actions.

Method 1

So we click here and we're in the stage.

And we can choose from the Action Menu.

Here are the groups, and they're in alphabetical order. Coordination before Core, before List, before Task, and Utility.

If you don't like to scroll, and you're going to utility or task, just use this filter to immediately jump down to the set of actions that you want to see. So, if I wanted to add a comment, I'd find it here, do a calculation and so on.

Method 2

The other possibility is I can click anywhere in the red box, and I can begin to type part of the name of the action. You will notice that you don't have an insertion point. It doesn't look like it's ready for you to type, but it really is. So, for example, I have the ability to take action that sets the value of a field in the current item. So I could just start typing set.

Notice that this has changed to a search box. It says there are five results. I can press Enter to view the results of the search.

It will open up the menu and there's the one I want. Set Field in Current Item and I can simply choose it.

I don't have to start with set if I know any word of the action. I'm looking for the word current. It says there are two results. Press Enter. Set Field in Current Item, and I can choose it just like that.

So if you know something about its name, the first word, a specific word that won't show up in all of them like to or from or something like that, just go ahead and start entering the word in the stage.

The actions available when you're creating your workflow are always going to depend on your context. For example, Start Approval Process doesn't appear here. Start Feedback Process actions, they're not avaliable either. When we don't see them at all, that's often because they're only available within a context. So if you don't see an action that you believe would be there, review your context, make sure you're in the right place to be able to call that action, before you assume that the action never existed at all.

Two easy ways to interactions, then. Choose from the list, enter part of the name and then press Enter to choose the precise action you wish from the menu.

Creating a workflow with SharePoint Designer that sends an email

Sending an email is one of the most frequently used actions in SharePoint workflows. Because we send people emails to let them know that it's time to look at a document, or to take a particular action. We use them for transparency, to let a user know that a particular document has been received, or that an item that they posted in the list has been moved to the next stage of a process. So, we're going to use email a lot. And this is the very first action that we're going to see how to create.

I've created a new HR site that I'll be using for the next few workflows that we create. And just a note that if the site that you are using or were thinking of using to create workflows in for practice has other users in it, it's an actual production site. This is a really good time to get a site set up that you can use that doesn't have other users in it, particularly people who are there just trying to get their work done on a day to day basis. And then we're creating new work flows that they don't need to use and they don't need to understand. So get yourself a nice pristine site with only users who volunteer to be guinea pigs to help you learn. And that's what my HR site is, a site with very few users.

I'm going to swing over to SharePoint Designer. And I've already opened up the site. So if it wasn't open when you go to sites, you can choose open in order to open it. And there are two major ways that I will start developing a workflow. The first is to say I want to create a new >b>List Workflow from the toolbar. That’s what we’re creating right now. And then I’m allowed to choose from the list and libraries that are here in this site. So that’s where this list comes from. And if I wanted to create a new list to the Documents library, I can do that. The second method is to look at my Lists and Libraries, open the library I want, and as I scroll down on the right hand side, notice that I have the ability to create a new workflow in the workflow section for this list.

So let's do that. And let's give this workflow a name, which is going to be Send New Document email. The workflow is going to send a new document email to the document library owner, to say, "Hey, there's a new document that was put in this library by this person", and you might want to go review it then.

We're going to enter a Description and it will appear in SharePoint Designer and in other places under the hood of SharePoint. When a new document is added to the documents library, this workflow automatically notifies the document library owner.

Now I need to choose the platform. And this is basically asking, what server do you have? This version of SharePoint Designer can create SharePoint 2010 workflows and SharePoint 2013 workflows. Select the Platform Type for your version of SharePoint server.

And right now, what SharePoint did very, very quickly is return to SharePoint Designer some information about the metadata that's available in that particular library.

I'm going to simply edit the stage name here to say Send Email.

And, I'm going to now add an action. Ad there are two different ways to do it. And you want to be keenly aware of where you are. If I'm in this section, notice that, that orange line is lit up in the transition to stage section. If I'm here, then the orange line is lit up in the stage itself. These are two separate areas. At the top, what we have is the actions that we want to take, or some conditions that we might want to add. Do this action if, and if not, do this other action. The Transition to stage are actions that say where we go when we're done with this particular action in this stage or this group of actions that we put together.

It says Start typing or use the Insert group on the Ribbon. If we use the insert group up here, we want to add an action. You're going to find that it's right down here under Core Actions, Send an Email.

It says email these users. I click on that hyperlink.

SharePoint opens a message form so I can address this to somebody. Now while I'm doing testing, I actually want to send emails to myself. So, it looks like I should be able to type in the To: text box, but I really can't. It's grayed out. I'm going to need to click to open this Select Users dialog. And I can choose people or groups from SharePoint sites, I can do a lookup. But what I want to do right now is just send it to me. And I'm going to click OK. I could copy somebody else on it. If I decide that I want to get rid of somebody here, the way I do it is to click again on our Select Users icon, choose me, for example, and remove me. I can't be doing editing up in these two areas. Now I want to provide a subject. And I could simply type new document. But the user, Carol, is going to get lots of these, and that is going to force her to have to look at the body of the email, or even open the email, depending on her Outlook settings, to see what this document is.

So I would like to put the title of the new document up here in the subject. And I'm going to show you how to do that.

There is an F of X button here that will allow us to do a lookup in the current item.

Clicking on it will open a Lookup for String dialog.

I select the Current Item and I want to choose the Title. And by current item, it doesn't mean this workflow. It means the document that was saved, the item that was saved in a list that actually kicked this workflow off. So I can say I'd like to actually put the title here. And if I do that, that's all I'll get. To finish, I click on the OK button.

And it will look like this. So then, all it is, is a document name.

I'd like to do a little bit better than that. So I'm going to click the

Build

button here, and open up the string builder.

And I could add text in front of this. But now that I am in an editable place I'm just going to select that. I'm going to say new document submitted. Carol may also have multiple libraries, but if she doesn't, if I just say new document, then click the add or change lookup button, which is exactly the same functionality as this F of X button right here. So I go to current item and I choose title. Okay. New document. Current item. In HR documents library. Now, if she's only monitoring one library, she probably doesn't even need me to say that. Don't worry about the fact that it kept this underscore from when I had the title there, because it's going to go in the subject line and it's going to remove it. That underlining won't be with us anymore. That looks good. I'm going to say OK.

Now we have New document - [%Current Item:Title%] - in HR Documents library in the Subject line.

Now I need to provide any other text that I want to put in this email message. So I can format in this area. I have some different fonts to use. I have sizes of fonts. And you should think of these as the internet sizes, where 1 is a pretty small font, 3 is about a 12 or 14 point, 2 is about a 10. And you can change colors, you can insert hyperlinks. These are the kinds of things that we can do here. So I'm just going to leave what we had a moment ago. And I'm going to say not too much, because she's going to get a lot of these emails. She'll be used to them. The new document, and I'm going to put its name here. I might even want to say, this new document was posted in the library, by, and we'll put somebody's name, like that. So this new document. Now, I could just put the title, and I would do that the same way I put it in the subject. But I want to make this wicked easy for her to be able to click a link and go right back into that document. Now I'm starting to deliver some value.

So this time, when I click Add or Change Lookup from the current item, I'm not going to choose the title.

I'm going to choose something called the encoded absolute URL. You want to remember this. Encoded absolute URL always provides a link that works in any circumstance for anybody who has permission to get to that specific item in a site. So if you put an encoded absolute URL, whether you're pointing to an item in a list or to a page or someplace else in SharePoint, if the user has permission to get there, this is going to get them there. And I'm going to say OK.

So this new document was posted in the library by, now let's go get the name of the person who changed it, who actually posted this document. So, we'll go back to current item, and this is when you really have to know how libraries are organized in SharePoint. Because the person who saves a document, or posts it, is the created by person. And there are several ways that I can return this field. I can use their email address, I can use a userid number, not a lot of good here. I can use their login names. But I'd just as soon use their display name. In this case you know, my display name is going to say my name. Carol's is going to say Carol Tyson. So it's nice and clear. There's no need, if we wanted them to be able to email we could say to email this person, we could put the email address as well. But this looks good.

And then finally, we would want to put some kind of a signature here. It could be as simple as, this email is automatically generated by a SharePoint workflow. Do not reply to this email. Cool.

That's what my email looks like.

So, again, the steps that got us here, before I click OK, are we said that we wanted to create a new workflow. And then we chose an action, which was, to send an email message. We clicked the hyperlink, where it says email these users. And this form opened. And then we chose at least one user to send this to. We created a subject using the builder button. And we created the body of the message using regular text and building this as well. I’m going to click okay. And this point I am going to click save. And that's how we generate the send an email action within a SharePoint workflow.

Notice that now that I have saved this, it's going to appear here on the list, send new document email, right here. This is an item that had been created earlier, and it is not live at this point. So right now all it is is saved. It's not available to anybody to use. So if I go to workflows, or if I go to my library and go to documents, and we scroll down and look at our workflows, this workflow is not yet available for use by my users. We are going to learn how to save and publish our workflow in the next movie.

Saving and Publishing Your Workflow

When we save a work flow, it's only saved here locally. So I want to be able to make this work flow available to other people. And in order to do that, I need to publish that work flow so it's available on SharePoint server. Now, I'm going to do that and it's actually going to be a mistake, it's not quite done yet. If we were in SharePoint Designer 2017 or 10, this would be a complete workflow. But it's not quite done yet. Because, it says there's an error in the workflow. And the reason there's an error is that, with the stages, in SharePoint 2013 workflows, I have to always say how I leave a stage. This is the only action I want to take, but I still have to close the stage down. And say, this is what we do when we're done. Notice, the transition section cannot be empty. Inert a go to action. So I'm going to click here. Notice there's my gold line shows where I am. And, I'm going to choose the action that is called go to a stage. And I'm going to click the hyperlink for a stage, and the stage is end of workflow, now the other possible stage was send email. That's the stage I'm in. Notice it doesn't make up stage two or five or anything else. It's just, I can choose a stage I've already created or I can end a work flow, and I just want to end my workflow. Now, it's always a good idea to check for errors, particularly if you're working on a slow connection, because SharePoint Designer could have told me about this without having to try to publish even. I'm going to check for errors now. It says the workflow contains no errors, and now I can publish it. And it's going to take a second to process this and send it up to the documents library and take care of subscribing the workflow so that it will be available for users, and I'm going to click on my lists and libraries. Go to my documents library here in SharePoint Designer. Scroll down and you'll notice that I now have a new email workflow, but it's got an issue. Right now, the only way that it can start is manually, and that requires my user to click something to send the email, and that's not what we wan. We want this to be automatic, so we're going to go back and tag up our workflow one more time, and choose to edit it. And click on Workflow Settings. And I'm going to say start workflow automatically when an item is created. Now this wasn't the only way I could get to this. I went to the workflow so that I could see its settings and change it. But it could also have gone to the document library and changed it there. I have lots of choices about this. But I want to start the workflow automatically when our item is created. I'm going to go ahead and click Save, I'm going to click Publish. Notice the work flow is being subscribed again. There actually was a version that ran for a while. If anybody had gone into that library and manually started that work flow it's available to them. So I'm going to close this tab. Go back to my documents library. Refresh it. Make sure it says manual start or when the item is created. There's my automatic start. There we go. Looks good to me. So, now I have a workflow that's available in the document library and we can test that workflow to make sure that it works as we intended to. But, you should have a good idea, at this point, how in SharePoint Designer you can either go to a work flow and pull the work flow from the list and work with it. Here's this particular work flow. I can edit it here, I've got all the settings on the ribbon, or I can approach a work flow by opening the list that it's attached to, scrolling down to this section. And I'm back in the position where I can edit it right here. So, either of those methods will get you back to the workflow that you want to be able to edit so that you can change it and save it and publish it again to make it available,

Testing Your Workflow

To test my workflow I need to be able to access the document library that the workflow was written for, and that library is here. And there is a web part representing it right here. And I want to simply put a new document into this library. So, one way to do this is to give myself a little more space here, and if you look in your exercise files for chapter five, you'll actually find a test document that you can drag and drop right there. Just like that. It's been uploaded. Everything's all done, so what should have happened is we should have had a workflow running. How would we know? Well, we can go to the documents library, and notice that there's "send new document email" right here. This is actually a new column that was added to this library by the fact that we created a workflow. This references the workflow, and it says the step that it's on is a step that's called send email. It should be doing that right now. We could refresh this, and the step still shows up. We can click this so that we can go see what it’s doing, and it says it’s completed and the email has been sent. So that’s pretty cool. How would I know? Well, I’d need to go open Outlook, so let's go ahead and do that. Remember that I sent this to me as I was testing it. I don't have Outlook logged in right now, so I need to do this. There we go, and let's send and receive all folders. This new document. There's the link. It was posted in library by. There's the user name. If I click this, it says, do you want to open a test document for sending email workflow? Do I want to open this, and I can click open and it will open that document directly? My user doesn't even have to go to SharePoint, and there's the test document that I uploaded. So, that's how I know my workflow works. There's not a lot to test here. There's one action that's taken. There's no conditions. When we start using conditions, we'll have other testing that we need to be able to do, but right now, all we need to test is did it in fact send the email and did it in fact end a workflow. And we know it sent the email because we can go see it here in my inbox. And we know that it finished the workflow because when I go to my documents library and I click that send email link so that I can see the report about what happened in my workflow, it says that this workflow completed. So that's pretty cool. I like how this is working. I like how easy it was for me to test. Now, when I change this to be Carol's email so that it's not sending them to me anymore when I'm out of my test environment, then I'll need to make sure that I test again just to make sure I'll, I'll actually go through exactly the same process and say, hey, Carol, did you get that email. So that I know that I didn't mistype her email address, or there wasn't some other issue like that. But, this is our basic testing to make sure our workflow works, and yes, it does. And we are very pleased about that.

Setting Task and History Log Settings

Before we move on, I want to talk to you about another group of settings that are here for your workflow that you want to attack early on. And that is these two settings here, for the Task List and the History List, and also whether you want to automatically update the workflow status. And that's a, just a really nice feature that's relatively new. The Tasks List that we're talking about here, actually refers to the Task List on the site. And so, one of the possibilities is that we could in the course of a workflow assign a task to someone. You'll find out how to do that. And, the question is, where do you want that written to? If we use the task list, the tier, or any other task list, I can then allow my Outlook users to be able to connect that task list to Outlook. And that's really pretty spiffy. So, if we're taking a look at our list in our HR site, and we go, for example, to our task list. Right here. It was created automatically even though it's not on the quick launch. Then my users can go in and can say, you know what? I'd, I'd like to sync this to Outlook. And that way, if I'm assigning them tasks within a workflow, you know, send this to this particular person to be reviewed or to be completed, they can actually see those tasks. And users like this because if they're task users in Outlook, they don't have to come to SharePoint to mark it as done. They can mark it as completed in Outlook and it will be sychronized back here. So this is a nice feature for me to be able to have. So when I'm looking at this in SharePoint Designer, you know, you wonder why would I use anything other than this one task list. Well, it's possible that you might have two or three workflows running in a site doing different kinds of things and you might want to segregate one of those sets of workflows or more than one. And if you wish to do that then you'll need to tell your users that they might want to sync more list in Outlook, if that's something you want them to do. The other thing is, the task list in the site might already be being used. So, you might want to create a new list. If you do that, all you need to do is say New Task List. And when you do, there will be a new task list. And it says notice that if we change this it might stop the workflow from working properly. This is exactly why we want to jump on this early on. It would really be great if we had done this even before we had ever published. If we are going to change this, it's a great time to do it early, early on. But what it will be named if I say, yeah go head and change it, is it'll be called send new document email tasks. So I'm going to just do that. It's going to create that new task list. Notice send new document email tasks. So, if you’re going to change these the longer you wait the worse off you are. And the same thing is true with history. Now history doesn't synchronize with Outlook like tasks do. But it is something that you can look at and others can look at. It’s, it’s a log. And you can say you want a new history list. And if we do that then we’ll have one called send new document email history. It's very predictable, what we're going to have here. You can always switch back to the one you had before, which is exactly what I'm going to do for both of these. If, in your wisdom though, you believe that you would like to have separate task lists or separate workflow histories please do it before you have even published it. Change those settings at the same time we would change our start option settings. You know, you're in the process of doing this, you're saving, and then before you publish, change these. It is possible to break a workflow by changing these after you've already generated some history. If you change these, you can actually lose some of the history, too. So, make sure that you're doing these early. And that's why I'm talking to you about it now rather than later. Also, if you wish, just leave this check box checked, it's on by default. This is the check box that made sure that when we were using our workflow and it went to the stage called send email, that it actually updated the status that we could see in the document library to send email. Let me show you that again so you remember what that looks like because it's this simple little check box that's doing that for us. In our document library where it says send email right there and right here. The status is being reflected. It's that check box doing it. We didn't have to tell it what to say. All we needed to do was leave the check box checked and we're automatically seeing whatever stage the workflow's in. So that's how this works. Now, if you actually wanted the workflow to do something like to say it was complete, rather than looking like it was in the first stage. You might imagine that all you do is add another stage called end work flow. And, you actually then would see end work flow, or work flow ended. So, some developers add another stage to the end of every work flow, that's actually slowing it down so that you can see that by using this automatic status update here. So, this is how you change tasks. This is how you change your history list, and this is also how you take advantage of this feature to be able to automatically update your status in a workflow very, very easily, rather than having to log in separately.

Creating a Workflow using the Wait for Field Change Action

One of the things that SharePoint does very well and that human beings do a little less well, is to wait with great patience. There are a couple of different actions in SharePoint that are all about waiting, but one that we're going to use a great deal is an action that waits until the value of a field changes. And, that action which we're using in this workflow, is called Wait for Field Change in Current Item. Let's walk through the workflow so we can see why it is that we will want to wait. Let me show you our process. Employee Onboarding is the name of that group of tasks that need to be completed when hire a new employee in an organization. So were bring them onboard. We're getting them on the same boat all of the rest of us are on. And at No Obstacles when we hire a new employee there are a series of tasks that have to be completed by the human resources group, by the technology group, by the finance group, the operations group, and then finally when all of those are done HR know that the employees been fully onboarded, and we're finished here. The way we got to this point is we interviewed people. We interviewed the folks in human resources; they described what they thought the process was that they were conducting. And then we went and talked to the folks in the tech group, finance, operations, and made sure that they all understood this process the same way. And it actually is sequential because the process is sequential right now. The people in operations and finance contact the employee with the email address that doesn't get provided until the technology group has done the work. So, this version of this is serial. We've gotten buy-in on it. This is the process that we're going to automate. Often, when you're in these conversations, and doing the business analysis for a workflow, what you end up with is a little different than the actual manual process. For example, there was no SharePoint list in the manual process. There was a list that was kept on a whiteboard in the HR department on one of the assistant's walls. But now there's a list in SharePoint which will provide transparency to everybody in the system without someone having to generate a lot of emails personally. And the other thing of course is we need to know who to send email to. So the HR assistant was able to tell us that the emails about technology and finance and operations are actually going to the directors of those areas, and they are then parceling out the work. And that when the entire process is done operations is notifying the Human Resources Director, Carol Tyson. This is all the information that we need. We need not only to know this, but of course to have a general agreement about it. But now that we do, we're ready to create our workflow. So as soon as we were done signing off on this process, I created a new list in SharePoint. Let's go take a look at it. So if we go in the human resources site to our lists and libraries, there's a list called new employees on boarding. And we can go take a look at what the columns are so that we can see that. We have somebody in HR who enters the full name of the employee and then there are three different columns for technology, finance and operations, where they're going to choose to mark something as complete. I know we're going to do a little bit more with this later on. So, I've actually built in a couple of other little bells and whistles. If we take a look at, for example, the technology column. It already has two choices, in process and complete. Because we'd like to be able to know when we're in the middle of that process, and we might also have in process, half done, complete. We could have whatever choices we want here. But that's how technology, finance, and operations all look. And employee full name is simply an open text box. So let's create our workflow. We want to create a list workflow and associate it with the new employees onboarding list. Remember that we're not just naming our workflow here, we're actually naming another column that's going to be added and visible to our users in the default views in the library. So, we could reflect what stage we're in in the workflow there so we might want to call this Onboarding Status. We could also call it Onboarding Process. And then we would enter a description. So we have a SharePoint workflow for the HR department's employee Onboarding Process created by me. Say OK. Now I can design this really light or I can build it out so that it has more opportunity for additions. I actually want to build this a little bulkier. I could simply say employee onboarding is the entire stage and build steps inside of this. But I want to have a stage for each point, each different movement through the process. So, the very first thing that happens in the first stage is we know that the workflow starts because we're going to have this start automatically when a new employee has been entered into the system. Remember that column that we can easily pick up what our workflow stage is. So we could call this that the employee has been listed in the system. Our employee has been listed in the system. So, what we want to do once the employee has been listed, is we want to send an email. And we're going to email me, because the technology department is first up, and that's not a real difficult thing for us to do. We're just going to make sure that that happens, and we'll choose an Action, which is to Send an Email. And we're going to email these users. So there I am, and the subject is that we have a new employee. So let's just build this out. A new employee needs technology. We can throw their name up in here, from the Full Name field. Say OK, and then I can provide some text and whatever goes in this email message can be a little bit or can be a lot of information. If I had for example a series of tasks, a check list I could describe. You know, here's the new employee and remember that you need to provide them with an email address, you need to provide them with permissions to the systems they need to get into, don't forget to put them into active directory, and into the appropriate active directory groups. So I have lots of information that I could provide here. But the core of what I want to provide right now in this particular example is simply to say that the employee has a name. And we're going to go grab that from exactly the same field that we chose it from before. And then I would say all of the tasks that need to be done, and I'm going to provide that encoded absolute URL to make it really easy for the person to go directly to this employee's record and to fix that. Say yup. That's complete. We're all done. So again, I can put whatever I need to in this message that's going to be useful, but this is our really basic, basic information that we're going to provide in this case. Just so we are learning how to use the action. I'm going to make a copy of this and I'm going to say OK. So we're emailing Ginny Courter. And then the next stage that we're going to have, the next action, is all of the work that has to be done assigning technology. So I'm going to insert a new stage. And we're going to call this stage, Assigning technology. I'm a just go ahead and create our other stages right now. This is going to be adding to payroll. We'll have a stage for assigning an office, and phone, for example. All the work of operations. And then our final stage is going to be onboarding is complete. Stage five. Now again I could choose to only have one stage and lots of steps, but by building this this way, I have more control over future expansion, because I've got nice little pockets that I can put groups of tasks inside of. Now, let's use that action that we are waiting on. So after the email is sent to me and I'm assigning this to someone, we're now in the stage where we want to be assigning technology. I could choose to wait, either here or here. But what I'm waiting for is for the record for this particular individual on the list to be marked complete. So what I'd like to do is as soon I've emailed the technology group, in my workflow, the very next thing that I want to do here is I actually want to begin waiting in the assigning technology stage. So that assigning technology will be reflected during the time that we're assigning technology. So, we're going to choose Wait for Field Change in Current Item and we're waiting for the field Technology to equal the value Complete. I want to say something about how this is different than how we might have done this in SharePoint 2010, because I know some of you might have 2010 workflows. The Wait for Change in Current Item has actually changed. This action itself is different than it used to be. It used to have three things that we could reference. We could reference the field that we were waiting for, whether we wanted it to be equal to, greater than, less than, and then what we were comparing it to. Notice, though, that we only get to choose two things now. It either is going to equal something, or it's not equal. Those are the only two things we can look at. We can't say wait for it to be greater or less than, so in this case I actually need to know what the status is that it's going to be changed to. I can't simply say, well as soon as the date is greater than January 1st of last year go ahead and do this. I have no greater than here anymore, so this is a little different than a workflow you might have seen in 2010. So we're going to wait for technology to equal complete. And as soon as technology equals complete, we're actually ready to send the next email. I can choose to send that next email at the start of this group, or in the adding to payroll, and that's not a bad place to put it actually. I could also have put emailing Ginny here, but we're getting ready to assign this to payroll. So, I think the next thing we'll do is we will send an email, and the email that we're going to send would be sent to Mark Lasea. And then we're going to wait for Mark to be done. So we're going to go up and grab the, Wait for a field change in current item. And we're going to wait for the Finance field to equal Complete. And those values, again, are being pulled right out of our list. As soon as it's complete, then we could move on to operations. And we're going to email a group of users in operations. So, it's the same thing. We're going to send an email to operations. We haven't written that email, yet, but we will. It'll look just like the one that was sent to me, probably, but with different tasks. And then we're going to wait. And we're going to wait for a field change. We're going to wait for Operations to be Complete. And then at that point we know that onboarding has been complete. So, the last thing we are going to do is we're going to email Carol to let her know that it's complete. Now, remember, of course, that we can't publish this yet because we need to put our transitions in. So, here we could say that we want to go to a stage, and the stage that we want to go to here is assigning technology. We'll insert a go to here as well. And the stage that we'll go to is adding to payroll. So in each case what we're doing is we're emailing folks and waiting for their work to equal complete. This is how we use the wait for field change action in SharePoint to be able to move work along and to wait for a signal from somebody that says the work has been done. This workflow isn't done, of course. I need to provide the other email messages. I want to return to the settings for this workflow and make sure that this workflow is going to launch automatically, and I'll also need to test this. But you don't need to hang around for all of those tasks. I'll finish the workflow back here in the editor, and then I'll be ready to publish it and I'll meet you in the next movie.

Adding Comments

There's one more core action that I use a lot early in the development of a workflow, and that's the ability to insert a comment anywhere to explain why I've designed something in a particular way, or to be able to make a note of something we might want to change in the future. For example, in our workflow, when we get to the stage where we are assigning an office and a phone, normally that would be done by the director of operations, but the director of operations is on a sabbatical right now, and is just leaving, and it's not even decided who's going to take over for him in this workflow role. So, in the interim, our CEO, Gerald has stepped in and said, well, you can send those to me till we sort this out, just so we can test the workflow. But, it doesn't make sense that we have the CEO assigning offices and a phone, and that's going to be a little weird. So, I'm just going to go in and add a comment. Now notice that I was actually selected up here, this will happen to you, too, so no, I don't want my comment up there. I could move it, but I'm just going to delete this action of the comment and make sure this time that I actually click either here or right above. And I think I'd prefer it there. And then I'm going to add the comment. And I simply click where it says, Comment Text, and I can open a builder and have a huge window to type whatever type of a string in that I want. I can add look ups to this if I'm making some kind of a technical note about how a calculation would be done or something else. But, I'm simply going to make a text note that says that, Juan Estes is on sabbatical, at this point Gerald will be taking his place in the workflow, we will replace her ASAP. And I'm not going to be able to see all of this unless I open it up. So I might want to say, regarding email recipient below say, OK. Notice regarding email recipient below. Okay, that makes sense. What's that? And I can click the builder and say oh okay now. Now, when I've replaced this I simply go in and remove this comment, but I believe you can see the utility of comments even here when it's go to assigning office and phones. I might want to say why we're always going to that stage or at the top, I might want to know why we're emailing this particular person and it's because we're going to assigning technology next. Any place you want to put a comment in a workflow, I would encourage you to do that. You don't need to spend your time trying to imagine the future use of comments, but if you want a place to note something in the workflow, go ahead and add a comment, it will be useful to you now, and it will be useful to you and others later on.

Using Conditions

Using Conditions to Make a Choice

SharePoint workflows include not just actions like sending emails or waiting for a change in a value, but conditions. Conditions determine whether or not an action should take place or allow you to chose between two or more actions. For example, we have a timesheet calculation that we do. When the timesheet's submitted, the very first thing our workflow does, is it checks to see if the hours are greater than 40. If they're not, it processes the timesheet, whatever that process looks like. But if the hours are greater than 40, then we need to make sure that we get approval for the overtime. So, there's the condition or test. Are the hours greater than 40? We have other conditions, too; Is the document a Word document? Was the document modified by a particular person and so on. Let's see where we set conditions in SharePoint designer. There's nothing for you to build here, we're simply going to look and see how we use conditions in a workflow that I've set up as a sample for us. So here we are in our timesheets submitted, and if we wanted to take a look and determine whether or not the hours, and that's the name of the column, are greater than 40. We would choose condition. The most common condition here is, if any value equals value. And that's actually the one we want. It's fairly common, we're going to compare two things. So, the first value we're going to compare, is actually in the current item, the column that's called ours. So if the current item hours, is greater than or equal to and we can look up a value but in this case it's just the number 40. That's how we enter a condition, if the current item hours is greater than or equal to 40 then do these actions that are inset underneath this. Let's take a look at the other conditions. The second possibility here, is that an item whether it's a new document in a library or a modified document or a new item in a list was created by a specific person. And we might want to know, was the document created by the list owner? If so, perhaps we don't need to notify them. Was the document created in a specific date span? So, if a document was created at a particular time that's more than a year ago, then we might want to mark it as needing to have a revision or at least a review. In the same way, we can look at conditions related to whether or not a document or an item was created by a specific person or in a specific date span. We can also make those same conditions based on modification. So was it modified by a particular person or modified last in a specific date span? Another condition that's available is, is the person a valid SharePoint user. And we don't use this for a document that was saved by someone very often, because they couldn't save it if they weren't a valid SharePoint user. This is a condition that we'll use often when we've tasked someone with a piece of work in a workflow. So we assign a task and it's possible for us to assign a task to somebody who is a valid user, because they have an exchange account, they have an email address. But they're not a SharePoint user. So before we go on, we want to make sure that the person we're assigning a task to can actually receive that task, and do something with it. And then, finally another common condition is that the title field contains some particular words that we're looking for. If I want to delete a condition after I've entered it, I simply select it and delete it. Now, notice that it's not simply going to delete the condition, it's going to delete everything that's in the black, which would include any actions. If I want to delete this condition. I might choose to do it here and this will only delete the condition and still leave any actions that would have been there. By combining conditions and actions together, we build very powerful steps into our workflow because conditions often are the thing that makes a workflow work. They replace the need for a human intervention to decide, is it more than 40 hours, was it created by the site owner, is this a valid user I can assign a task to.

Using Conditions to Control Flow

You can chain multiple conditions together to create an if-then or if-then-else statement or even what's called a case statement, the type of condition where you have option one, option two, option three and so on. I'd like to take a look at a portion of a workflow that we're going to be creating, and this is a request for a new position within an organization. We get this business diagram from the business analysts who did the work of assessing this process, and so it comes from the IT department. This is a kind of diagram, often called a swimlane or a cross-functional diagram, and if you're not used to these, you'll want to spend some time looking at this because this is a really great type of diagram to use to be able to capture things that you're putting in a workflow because it not only shows the flow of the work, but on the left-hand side, it's showing us who's doing the work. So let me walk through the if-then portion of this. We have a manager who fills out a form requesting a new position, and then that is sent in the workflow to the area vice president. And if they approve it, then it goes to the finance vice president. And if the finance vice president approves it, then it goes to the human resources vice president. And if the HR vice president approves it, then the position's posted. And we notify the manager and all the other actors within this workflow that the position has been posted, and we end the work flow. So that's the if-then. If the VP approves, if the finance VP approves, if the HR VP approves, then we post the position. What if one or more of those folks wouldn't approve it? Well, the way this is laid out, as soon as there's a, a denial, we don't bother to ask anybody else. We just notify everybody else, so it's if everyone approves, then the position is posted. Else someone has denied it, and what we do then is we notify everybody. So the HR vice president may never have been asked to approve the position because the area VP turned it down, and yet we will notify them so that everybody's in the same conversation. So if everyone approves, then we post the position, else the position is denied, and we notify people. So that's what this diagram looks like. When you see something like this then you know you're working with if-then else, and you want to make sure that you've got everything in the order that you'd like it to be in so that you feel really comfortable creating this workflow because that's what we're going to do next is we're going to work it creating a workflow with conditions in SharePoint designer.

Create a Workflow with Conditions

Here is our workflow with many of the actions either built-in or commented so that we can build them in later. And we're ready to add conditions. Let me quickly walk you through the workflow. You can create this if you wish. First, we have our Position Requests list. And it's a little different than it would look in earlier versions of SharePoint because of some changes to the way we wait for a value to change. We have a Position Title, the name of the department and that's a lookup based on the department list that we also have, a proposed start date, minimum and maximum salaries, and then the structure of the job. It is part time or full time? Is it exempt or hourly? That's a drop down list as well. All of those are required. Then, we're going to ask the Vice President in the area, the Vice President of Finance, the Vice President of HR, to choose approved or denied in each of these. Now, the problem is that when we use the action that is waiting for a value in the current item, it can't just look for it being empty or not empty, greater than or less than, and we have two choices. So, if we say, "Well, we're gonna wait until it's approved," what happens if it's denied? The workflow won't continue. So, our list needs to be able to capture whether an item was either approved or denied. In other words, whether or not this field is no longer blank. As soon as Area Approval isn't blank, we'd like to know about it. Same with Finance Approval and HR Approval. So, what I've done is I've created a calculated field and that calculated field is simply looking to see if department approval, for example, is blank. And if it is blank, then it is returning a yes or a no. The same thing is true with finance here. Is it blank? Yes or no. So, we can wait to see if Area Calc, Finance Calc, or HR Calc have been changed or not. That's the only thing that's a little wild when we get here. That's what's going on in our list. Here in our workflow, we're going to email our submitter. And if you wanna know how we're finding the submitter in order to send that, then there's a movie called Emailing the Submitter, later on you can look at, and then always from this particular stage, we're going to the area of Vice President Review. I have a comment that we're going to need to look up the information, the email from the department's list. Now the question is, how do we get out of this stage? This review stage. So, the first thing is that we need to see whether or not we have had a change in that calculated field. So we're gonna wait for it. We're gonna add that action, wait for a field change in the current item, and we're going to wait for the Area Calc to equal the value of No. As long as it's blank, it will say Yes. As soon as it's no longer blank, it will say No. Now, what we know is that our Area VP has chosen either approve or to not approve, and we wanna go to one of two places based on that choice. If they've approved it, we now wanna send this forward to the Finance VP. If they've declined, then we can immediately go to Position Not Approved. So, we need to include a condition here. Our condition is going to be, if any value equals value. If in the current item, the Area Approval is equal to Approved, then with the stage we're going to go to is the Finance VP Review. We can simply choose, Go to a stage, and the stage will be Finance VP Review. Otherwise, it means that they declined it. We know they changed it because Area Calc is equal to No. So, else, we don't have to say if current item area approval equals declined. We just need to say that what we're going to do now is we're going to go to the stage that is Position Not Approved. Now, we could choose to add another if here. If we wanted to, we could be very specific. We could say, "Well, while we're testing this, "we wanna make sure that the user "didn't enter any other value." That column only allows two values, so it's pretty easy to say it's either going to be approved or denied. We don't have to do another if to deal with that. Let's do this again now. We have a couple more of this to do. Let's go ahead and add the condition here for the Finance VP Review. Now remember, we only get this far if it was approved by the Area VP. So now we're going to add the condition that says, if any value equals value, and what we wanna say is, "If the Finance Approval "equals Approved, "well then, we're willing to go on to the HR VP Approval." So, we're going to, Go to a stage and the stage is going to be the HR VP Review right here. Otherwise, we're done. Same as before, we're gonna go to the stage that says, "Nope, the position wasn't approved." Now, in order to get to this transition, we have to build that other action in just as we did here. We need to wait for the Finance Calc to equal No. After we've emailed the users, we wanna wait because otherwise, we will simply drop through this and it won't equal Approved. It won't equal Denied, it won't equal anything. So, we're going to choose Action. Wait for a change in the current item. We're waiting for Finance Calc to be equal to No. If it's no longer blank, therefore, it's time for us to evaluate it. One more time, just to be clear, we have the HR VP doing the review, we've emailed them and we're waiting now for that Calc field to change. This is for HR. We're going to wait for HR Calc to equal No. It is no longer blank. When that's the case, now we're ready to add our condition. What did our HR VP decide? How did they approve this? If they approved it, that's great. We're gonna go to the Position Approved stage because now, we've walked through all of these different conditions and we know we're good to go. We're going to go to Position Approved. Else, we're going to go to Position Not Approved. Once we have this pattern, it's the same over and over again. What happens if the position's approved? We're going to post the position, we're gonna send an email to the users and now, we're done. The process is complete. So, we're going to say go to Process Completed. What if it's not approved? Well, we're sending an email anyway. And how we leave this particular item is we also go to Process Completed. When the process is approved, we post the position and send an email, "Hey you all, it was approved." When the position is not approved, we send an email to everybody that says, "Hey, sorry, we didn't fund this position, "for whatever reason." This email could include more information about who approved, who didn't, and so on. That would probably be worth doing. Finally, our last stage of the process is complete. Remember, we have to have a way to transition out of every single stage. This stage, we're going to transition out of by saying, "We are ending the workflow." That's how we use conditions in a workflow. We're using the conditions here to transition out of a stage because of how we built this. We could also simply be using the conditions to either approve or disapprove within a step but this is a really elegant way to lay this out because it's clear what we're doing. We're moving from one item to the next based on whether or not it was approved. If it's approved, the next person gets to review. If not, we drop down to the Position Not Approved stage. If the Finance VP approves it, then it will go to be reviewed by the HR VP. If not, the position's not approved. Here's our HR VP, same thing. That all works. What if this didn't work for you? Specifically, what if your workflow generates the email and changes the value in Area Calc, but then the workflow doesn't do anything else? If that's the case, there's very good chance that you're using Workflow Manager 1.0 in your installation of SharePoint and it has a known issue. It doesn't like changes that are being triggered by Boolean columns: yes/no or true/false. The fix is to avoid those types of columns and instead to use the number data type and use 0 for no, and 1 for yes. There's an FAQ that I've posted here on the site so that you have specific instructions on the functions that you will wanna create to be able to use the numbers rather than the check boxes. If this is the behavior you experience, the good news is that now you know that in the future, you will want to avoid using Boolean columns as triggers for your workflows. This is important because this affects not only using Boolean values here, but using Boolean values if that value were retrieved from a column. This will be an important consideration when you're designing custom list and workflows in SharePoint 2013.

Using the Else Branch

In the new position request workflow, we use something called a Serial If/Then set of conditions. We said, IF the Area VP approves THEN. We check to see IF the Finance VP approves and THEN. If the HR VP approves then and only THEN is the position approved.

So we're actually going through each of these steps, we're checking to see if the area VP approves and if they do we don't get to say well that's good enough, we can now process the new employee indeed. All that does is give us permission to ask more peoples' opinions about whether or not we should be having this new position. So in a Serial If/Then, we do each of them and we do them in order.

There are a couple of other options about how we might want to arrange conditions. The next one that we're going to look at in this particular lesson is not Serial If/Then, it's actually called If-Then-Else.

Let me introduce you to another list. It's the credit card transactions list. I created this list very quickly and easily.

It has a title, a drop down list with the three types of credit cards that we take which are Visa, American Express, and Mastercard. There is the ability to enter an amount with two digits so it looks a little like currency, and the ability to store some text, the credit card number. This is a good example because we all understand broadly what credit cards do and that there are types of them.

So if we were to adapt exactly that same Serial If/Then process, let's see what that would look like. Here it is in our new position request, and if we used it for a credit cards what we do is we say well, we're processing a credit card. If the type is American Express, then let's use the American Express gateway. And then we check and say well is it a MasterCard? If it is, then let's use the MasterCard gateway. And if it's a Visa, then let's use the Visa gateway.

The problem here is, that we only need to do this until we get a Yes. If the credit card is an American Express card, we never need to ask if it's a MasterCard or Visa. We're done. And so this is different than, that the serial, If/Then conditions in fact what we want to do, is we want to check first and see if it's an American Express card. If it is, then we simply are going to process the card using the Amex gateway and we're done.

What does this look like? Well, we have else is in here, and there's our clue. So, if the type is American Express, then use the Amex Gateway. Else or in other words otherwise and only otherwise, see if it's a MasterCard. What if it's not a MasterCard? Well, then and only then, else see if it's a Visa or possibly sometimes when this is created, there won't even be a check to see if it's a Visa. If it's not an American Express and it's not a MasterCard and we know it's a credit card, it must be then that we're going to process this using the Visa gateway. Because we only take American express, Master Card and Visa.

So this is what the If - Then - Else condition looks like. It's a different kind of a condition and we're going to create this differently when we create the workflow.

Let's swing over to our list and create a workflow for it, so you can see what the tools here are. Here we are in our list. We could do this in SharePoint Designer, but I'm simply going to go to my list, go to Workflow Settings, and Create a new workflow in SharePoint Designer. Of course, I have these three dialogs where I need to allow them, but other than that, it's not a bad thing. And we're going to call this process cc transaction. And this is a demo. I'm going to say OK.

So in the first stage, we need to do two things. We're going to determine card type and process transaction. So we'll start, then, with a condition. If any value equals value, just as we did in our last example. So if, in the Current Item, the credit card type, equals American Express. Cool, then we would do something, we would process this and we, we might have some code to do that or whatever else we might want to choose. I'm simply going to insert a comment here. Add a comment. I'm simply going to add a comment that says, process using Amex Gateway. Just so we have something here. And this doesn't do anything. All it does is it serves as a placeholder, and reminds me we need to do something else.

Now, what we want is an Else branch. And this is the part that's not only important, but it's different. This is not how we did this in 2010. So, while I'm on the If. Here's my If and the action that I am taking, and I want to click right here.

And I'm going to add an Else.


I still need to ask If. Because all I know is it's not an American Express. So, if, in our current item, the credit card type equals MasterCard, then I'll just go ahead and insert my comment again, add a comment, my comment text is, process using MC gateway. Okay, one more choice, one more Else. So I want to be here, say right here, around the place of our comment, a little before our comment, and I'm going to insert another Else. And I can do the If, if I want again. So I'm going to say If, in our current item. Our credit card type is equal to Visa, I like pulling those off a drop down list, then we'll just add a comment, and that will be process Visa gateway. So this is our If, Then, Else. Let's walk it. If the credit card type equals an American Express, then process it using the American Express Gateway. And we're done. Else check to see. Is it a MasterCard? If it is, process it using the MC gateway and we're out of here. But, if it's not, Else, if it's a Visa use the Visa gateway.

So this is how we construct If - Then - Else. We could have all of these done serially. We would just be checking every single transaction three times whether it needs it or not. And clearly only the Visa transactions would need to be checked three times.

One more quick thing, I did these in the order in which they appear on the list. But if 80% of the transactions we process are MasterCard transactions, why not put them first, it's more efficient. We actually would want to structure this, either in some kind of alphabetical order for text, numerical order for numbers and chronological for dates, or you want to put them in the order in which they are most likely to be chosen.

I need to do one more thing. I need to say how we're going to end this workflow. So I'm going to go to stage, and the stage is going to be the end of the workflow. This will allow me to check for errors. I don't have any, and I'm going to save this, it's going to come back, this workflow, much later in this course when we talk about some other best practice topics around workflow design.

Using Parallel Blocks

Here's our workflow, with one condition after another.

Does the Area Vice President approve? If so, let's ask the finance VP. Does the finance VP approve? If so, let's ask the HR VP. This is one way we can design this workflow, and if this is the way that the business wants it done, that's what we'll design.

But it might make sense to have these processes happen in parallel. We could, for example, have all three of these Vice Presidents looking at the position request at the same time. They could be in dialogue with each other. And perhaps, more importantly, if the Area VP is on vacation, that holds up this entire work flow for everyone. The Area VP comes back. And by the time she's done, the Finance VP is out of the office for a week. Whereas, we could have caught Mark when he was in, if he'd had the ability to be participating in the work flow sooner. What would it look like if we designed a workflow in parallel?

Here's our same workflow, but with paralellism.

We send the completed form to all three of the Vice Presidents at the same time. Each of them gets an email that says, "Hey, go take a look. We've got a request that's been filled out" and they can handle this then as quickly as they can get to it. It doesn't matter that Mark's out of the office, because Carol can still look at it. She gets it at the same time. We'll then wait for all of their approvals to come through. And if all of them approve, then we will post the position. If any of them do not, then it will be denied.

So let's take a look at the different structure we would use in our workflow to be able to create this portion where we're having all three of these VPs receive the information at the same time, and make their decision in parallel.

Here we are back in SharePoint Designer in our position request list. I can create more than one workflow on a list. Remember that this workflow that I created already isn't active because I haven't published it yet. So there's no reason to delete one workflow to create another. Or to say, well I've already invested time in this one, I don't want to look at a different way to do it. You can actually create both workflows, save them both, discuss them with the business and then decide which one you actually want to use.

So we have a new position request. This is going to be a parallel process, it's a revised process with the approvals in parallel. And I'm going to click OK.

So the first stage that we have in our workflow is that we actually have received this application for a new position. And the next stage then is our approvals. And instead of having one stage for Area of VP Approval, the next for Finance VP Approval, we're going to just put VP Approvals.

Now I want to add a parallel block.

A block has to live in a stage, I can't put it where I don't have a stage. And it says these following actions will run in parallel.

Now I can insert three actions.

For example, three steps that will run in parallel.

The first step is going to be my Area VP approval. My second step, and I'm going to click back out here, I'm in the box that says the usual run in parallel, but I'm not in this step any longer. I'm below it. Notice where my insertion is going to be. And I'm going to create a second step. It is going to be the finance VP approval. And then I'm going to create a third step. Now notice that this one's not in the block. See, it's outdented. So I want to get rid of this. Just select it, and hit Delete, and it's gone. I'm going to click to make sure that I'm in that parallel block, right there, to create my third step. There we go. HR VP approval. So in each of these blocks I'll have the same actions that I put into our other work flow.

We'll be emailing an Area Vice President or emailing a Finance Vice President and finding out what their opinion on this is, but this is how the parallel process works. And then, once we come out of this parallel process, the items that I will have them do, each of the VPs, we can transition then to one stage or another based on whether or not all of them approved. So, I'm going to then use a regular conditional that says If Area VP approval. So if the area approval equals approved, if finance approval equals approved, if hr approval equals approved, then, great, it's apprpoved. But, if any one of those is not the case, then it will be not approved. So, there is the else. If area approval equals approved, if finance approval equals approved, if HR approval equals approved, position approved. Else, position not approved.

So, that's how this will work. We'll simply put our parallel block together to replace those three stages. With one stage with a parallel block and three steps, it will be more efficient. And then when we leave that block, we'll put a condition in place to decide whether we go now to the position having been approved or the position having been declined.

This is how parallel blocks work. They will always appear within a stage. And you can imbed one parallel block into another. So if under Area VP Approval, we needed to email three people in this step, we don't have to do them sequentially. We could actually put in another block for items that would run in parallel within this parallel block.

When you're having conversations with the business about how you want to design work flows, don't forget that everything doesn't have to be done sequentially. We're used to a world where we routed items from one person to the next to the next but, often parallelism will give you a better work flow and a more efficient work flow.

Using Loops

Parallel blocks are one relatively new feature that we can use to design better workflows. Workflows that make more sense and are more efficient. Loops are another and they are brand new in SharePoint 2013. For a number of years those of us who use SharePoint Designer have been critical about the fact that we couldn't simply. Return and do an action over and over again, without building it into the workflow over and over again. Looping gives us the ability to do that.

I've created a small document library and added a couple of custom columns to show you a little bit about how looping works. In this library, when someone drops a document in the library. The purpose of the library is to create a place where articles can be stored but where the can also be reviewed. So when I write a new article about some aspect of HR, I'm going to ask to have a particular person review it. And I'm going to choose my reviewer because I want someone who knows that part of the business or who understands the nuances of benefits, for example. Or tax law, whatever it is. So we have a title for document, a reviewer and then we have a state, and the state is that it can be a draft, I've just placed it there but it can be in review or it can be final.

Now, here's why we need loops. When I save this document and choose the reviewer, I might have gotten in touch with them and said, I need you to do this, and we have a short time frame. We have seven days that something can sit there waiting for review. That's our policy in the HR department. But what if that person forgets or they are out of the office the first day and they come back and they're busy. So, what I'd like to do is send them an email every day if they haven't done this review yet. I'd like to harrass them. You probably have email in your inboxes like that too that reminds you that you need to reset a password. And you get that email every single day until you've done it. That I've done with a loop.

I'm going to go to Workflows. And we're going to create a new workflow. And it says lists, but lists include libraries, so here's our articles library. And this is just a demonstration, so I'm going to call it Loop Demo. Okay and we're going to do looping with a condition.

Loops always appear within a stage, and I can loop n times or I can loop while a condition is or is not true. So, let's imagine that I want to loop with condition because that's what fits here. As long as we haven't changed the status away from draft to in process, we're going to want to continue to harass my reviewer. So, I'm going to do a loop with condition. And it says the contents of this loop will run repeatedly. While, well, I'm just going to throw the contents in here real quickly. Which is, we're going to send an email. And then, we're going to do another action which you'll see a little later. We'll call it pause And I want pause for duration. And I'm going to pause for one day. The five minutes was the default. If I don't want one day and five minutes, I just change that to a zero. So, the contents of this loop, this is all in one loop, will run repeatedly while value equals value. So, I have value equals and I can choose equals or not equals or something else. And then my other value. So in the current item, while the state equals draft. As long as the state is still draft, we're going to send that email, pause for a day, do it again. We'll check and see does the state still equal draft? If it does, we'll email that user and we'll pause for another day. That's exactly what this loop looks like. Now, if I choose the other looping action, which I wouldn't in this case. The other looping action is useful when we know we want to do something a particular number of times. And I don't have to know the number going in, actually. I can say I want to loop N times. And, I have the ability to enter just a number in here, but I could also go retrieve that value from somewhere else. Or I could calculate this value. So, I don't have to be able to say five or seven or nine. I could say, go look in the current item and find that the value that the user supplied. So, it can be a lookup based on particular information or it could be a number. I'm going to do it seven times. Seven times I will send this and then we'll do something different. So, I can either put in a reference to a variable or I can insert a look up of some kind in the current item or somewhere else. So, here we have the built-in everyday nagging reminder and here we have the ability to do some series of actions, can be more than one. A specific number of times or a number of times that, that I have looked up somewhere else to be able to set that.

This is how looping works in this version of SharePoint. Whenever you want to repeat an action or a series of actions, you will want to use a looping structure in order to do that in SharePoint Designer.

Creating a Simple Form for Your Workflow

Using Built-In SharePoint List Forms

There are two major methods your users with utilize to enter information into a SharePoint list. The first is simply to switch the list into the edit view and to go type more information.

So, we need a network installer in the technology area. That position is open now. We imagine that it's going to take us awhile to fill it, so maybe January 31st. OK. And we're going to start that position at $82,000. And this is going to be a full time, hourly position.

Now, these are the three columns that are waiting for the workflow. And these are the three columns that are calculated columns based on whether or not we have a value in area approval, finance approval and HR approval. As long as they're blank, this field will say yes. As soon as one of them is filled in, though, notice that it says no, so we won't be filling these in. We'll just be stopping here and that works just fine. A lot of users like working here and we could choose to hide any of these columns we wish. We could choose to hide area calc, finance calc, HR calc, so that they are just not available because they are only used by the work flow. A user would probably find them more confusing than helpful.

Now the other way that a user can enter information is to use a form and there's not just one form that was created for this list, there are three of them. Whenever you create a list like this you get three forms. I'm going to click New Item and you will see one of the forms.

This is actually the form that you used when you're entering new information. So, it has all of the fields that a user could conceivably enter, but none of the calculated fields are here. They have the ability to use date pickers, drop down lists, and so on. Defaults are built in so that you can see them here, and that's what this looks like.

Now, let me show you where you’ll find all three of these forms, and it’s pretty easy then to understand how these are working. Let’s go back to SharePoint Designer. And here we are in our position request list in the form section. And the form we just saw is called newform.aspx. We also have a version of the form that's very similar to that, that we will use when we edit. And then finally, there's a third version of the form that is only used for display, so it's a read-only version.

If we want to see any of these, for example, the Edit form, I can click and you'll notice that it looks very much like the form that we saw when we were looking at a new form. And if I choose displayform.aspx, and preview this in the browser, you'll see that there is just a way to present information. There are no controls here that are available for us to provide information or to edit information. This is a read-only view.

If I click the hyperlink, what it will do is actually open the ASPX code for this form. If you know what to do with it, feel free. But this is the code behind this form.

You don't have to be able to work in this mode to be able to modify this form though. You can modify this form in InfoPath, and you can also modify the form in SharePoint Designer outside of this code window. We have a couple of different ways to change the form.

I'm going to go ahead and close that view. So, three new forms created every time we create a new list. If this set of three forms provides everything that you need for the workflow that you're creating, feel free to rely on them. They were created for you. You don't have to invest any extra time in them. They're easy to use. They're modifiable if you wish, and your users will have a fine time using the built-in forms, or using the Edit view to be able to add information here.

Using InfoPath to Create a Form for a Library

If you want to modify the built-in forms that come with lists, or if you'd like to create a more customized form, particularly a form to be reused as a template in a library, then I'd encourage you to take a look at Microsoft InfoPath. InfoPath 2013 lets you create two different types of forms. One type of form is the type that we're using here. It's meant to be filled out in a browser, so it's a web form. The other type of form you can create is a form that's made for offline use, so it's used with Microsoft InfoPath filler.

You probably have InfoPath on your computer. If you're not sure, then what you'll want to do is go to All your Programs, to Microsoft Office, and make sure that you've InfoPath Designer 2013, just like this. InfoPath Filler 2013 is the client that's used to fill in forms. So you want InfoPath Designer. And as long as you have that, you can modify forms for use with SharePoint. So if I go to List, I can choose to Customize My Form right here. And it's going to ask if it's okay if it opens InfoPath Designer, and I say Allow. And, once again, as soon as I have a web site trying to fire something on my computer, that's what a virus looks like. So, all of these other dialog boxes pop up, but I know what I'm doing. I'm opening up InfoPath Designer. And that's what it should look like. Here's the form that we saw earlier. This is actually the default form for a library. And so if, we wanted, for example, not to have the ability to have attachments, we could delete this control. We can delete this whole row and get rid of this. That's one way to modify the form. Now if that was something that was required, if attachments were required, we could tell by looking here in the field list. It would say it cannot be blank and it would have a red asterisk. This would give us a problem. We can't actually edit a form in such a way that a user can't create the data they need to, to be able to meet the criteria established for saving a list item or saving a document. So you want to be careful here and not delete the ability to enter all your required fields. But for example, this drop down is really, really long. We don't need it to be this long. We can move it way over so that it's more reasonable. So we have a start date here with lots of extra information. That's the time. We'll get rid of that. We just need a date, not a time. And we have a salary minimum and maximum. And what I could choose to do is to split this. I have a couple of different ways to do this. I can say that I'd like to draw the table, and I could just drop a line down here, and then we'd move that maximum up here. And enter and maximum, which would give us more of a range. We can create a drop-down with ranges in it. We can delete this empty row now. And the choices on the structure list are also very short. If you want to see what any of these are, you can go over here and you can actually preview the form real quickly. And notice that they're short little choices. And these are as well. So, we might want to do something about this. We have you know, a number of different choices about how me might handle this. We could add a layout table and say, you've got four choices here, and we'd like them to look a little different. So let's find a way to put in a better looking table. Let's insert, for example, something that gives us four up. There's a couple of four column choices. Here's one that doesn't have any headings on top of it. That's great. Notice we have Add Label, Add Control so, what I'm going to do is I'm going to get rid of these controls out of here first. There's structure, area approval, finance approval, HR approval. And they're over here in the list so I'm going to take Structure and I'm going to grab it. And if I drop it right here, it will add the label on the left and drop down here on the right. And then I'm going to do the area approval, finance approval and HR approval. Just like that. Got a little extra stuff here I don't need. There, here, and I don't need any of this. So I can just delete all these rows. I kind of like that. See what it looks like. Yes, I want to connect to my data sources in SharePoint. So this is what it's been like for us to modify this form. When I'm all done, I can simply say I'd like to save it. I can save it locally and republish it then, to that list or library. I can use this particular form for other purposes, if I want to make a copy of it. It's got lots of really nice choices for me. I'm going to ahead and publish it back to my library. This takes a little bit of time. It was successfully published. I'm going to open it in my browser. And now when I choose New Item, I'll see the forum I customized. So create the form, save it locally if you wish. Publish it back to your site to be able to use it with your SharePoint list. That's how wicked easy it is, to use InfoPath, to modify the built-in forms, so that they look better, or will better meet your needs.

Creating a Form Library from InfoPath

If I only want to save data, I can probably do that in a SharePoint list very easily. But I might want to create a form and be able to save the results of my users filling that form out in a library, all by itself. Essentially make that form the template for the library, and be able to create workflows on that library and do all kinds of exciting things, and the way I do that is I don't start by creating a library, you might think that you would, but we don't. We begin instead in InfoPath and create a form that includes the information that we want to capture. And then we publish that form to create a library.

If you're using SharePoint a lot for workflows, I recomend the InfoPath course. It's hard to do workflows without doing forms. The more complex your workflows are, the more complex your form needs are.

But I'm going to begin by saying I'd like to create a SharePoint form library. And click design form. And it gives me a form to start with. Now, I'm going to create a form for our mentor program, so this is simply going to be a mentor report. And I'm going to create some fields here. The first field I'm going to create is the Mentor Name. And that's a text string, and that's just a text string and it cannot be blank. And, it says, you can't put spaces or special characters in here. It's very helpful to me, okay, fine. I'm going to leave that uppercase N on purpose. This is called camel case. Where I upper case the first letter of every word and there's a great reason for that. As you'll see in a minute. Let's add another field. And we can say that we want the mentor email address but lets say we want the mentor title instead. Notice that I used an upper case on the t. And the mentor department. That's good. Now, we want to know information about the protoge or the mentee. So, this is going to have mentee name, mentee email. And the mentee department and the mentee title.

Now I wish I had put the title in before the department so I can just click this drop down arrow and move it up. Notice that I can flip 'em around. I can see the details. It says that they're all strings. I would have had choices do something like a date instead. And I could still do that just to have it reflected here on the form. So if I do, I'll go back up to my fields, and I'll add one more field. And I'll put date submitted. And, this time rather than text, we're going to choose date. And, that's fine. So, I'll start by taking the date submitted, and we'll put that right here. That looks great.

Now, notice that I don't have a space here, but because I used camel case. When InfoPath created a label, it put a space prior to the capital S.

I'd like to know the mentor name. Notice that I am releasing this when I have both add label and add control areas, and it puts the label and the control in the right places. And the mentor title and the mentor department. Just like that. Now, I have dept, so if I want to change this, I can just edit it. And this is mentor information.

And this is going to be mentee information. Nothing hard going on here. So let's have the mentee name, and the mentee email, and we want the title in the department. And it would be nice if we had just one more line here. Let's go ahead and tab out of this cell here, to get another row. And let's grab Mentee title. Even though the add control prompt is gone, it still works fine. And the department. Now, I simply use these layout tables as they were built. It would be very easy for me to change them if I wish, and, you know, just do some minor modification. So that, I had. Four up as opposed to two up. These fields are ridiculously long so we can make this table narrower if we wanted and we could center this table but just go ahead and leave it for now. And I don't need this information or this information. So that's how this works, we've got a form. And there are a lot of other tools that you could be using here as well, but it was pretty easy for us to create this form this quickly. So, let's save this form. And I'm going to put this in our exercises folder. Here in exercise files, and we'll call this mentor report. And, notice that it's designed as a web-browser-form template, that's the default because I chose to use it with SharePoint. Go ahead and save it. If I want to preview how this works, I can click the preview button and take a look. Has place for me to type. If I tab from spot to spot. It's all going to work nicely, and again, this is good enough.

So, the next thing I need to do now is I need to actually create a form library. And I'll need to have the URL for my site in the HR department site. So here we are in the human resources site. And I'm going to be asked where my site is. Now, when we look at the URL starting with the underscore layouts, this is a conversation about this page. This is the site ending with HR so I can copy that. And it will be nice to have. Now we're going to head back over to InfoPath Designer and in InfoPath Designer what I need to do now is I need to publish this form. So if I click the tab for file it tells me that I need to publish my form and I need to set submit options. Now the submit options say when a user saves the form and submits it, where does it go? We want it to go the library. That library doesn't exist yet because I haven't created it. So you will always come in, publish your form, set the Submit Options in your form and publish it again. So that the version of the form in the library is one that has submit options set. So let's publish to a Sharepoint Library. It asks for the location, we have just copied that URL. Right here. Click Next. It's set to be filled out in a browser. It's going to create a form library. That's what we want. Click next. I want to create a new form library. Click Next, and I need to give it a name. And I'm, you know, creating a library. So if I leave a space in it, it will have %20 in the URL. So I'm going to just say Mentor Reports. And I can provide a description here, or I can modify that in SharePoint afterwards, it doesn't really matter. This matters though. Because what I'm being asked is, of the forms fields that are being filled out, how many of these do I want to reflect as columns over in SharePoint? So right now it would actually save the forms in the library when I'm all done with this but I wouldn't have any columns to show up in a view.

So, I want to add some columns, and I get to choose the order in which I would like to present them. So, let's say the very first thing I want to do is, I want to show the mentor name. So, I'm going to choose mentor name and say okay, and it will now be a column in my library. I'm going to add the mentors Department. I don't need to have all of the fields, I don't want, for example, their title in this particular list. If I want it in any view, though, this is the only way it's going to get there. So, there's my mentee name, and I'm also creating Column headings here. So if I want just to name this mentee when it gets over to Share Point, that's what I'll do. I'll just change it right here. Notice that it changes that. I can modify mentor name so that instead of mentor name it just says "mentor." By choosing modify. And, now let's add our mentee email address. Notice it says mentee email with a space. That's great. So I have the mentor, their department the mentee, the mentee's email and I'd like the mentee's department too. So, we'll go grab that one more thing. I don't need date submitted, I like having it on the form. I think that's great. But, Sharepoint's tracking that already, as soon as somebody creates a new instance of this form, as soon as they save it, Sharepoint will be tracking that. So, I don't need to have it there, but it's nice to have it in the form. Click next, says we're going to create a new form library called mentor reports in the HR location you want to make sure that this is correct and we're going to publish this. Now I can open this form library if I wish I can open the form in a browser but I'm just going to close this. I think everything's fine there. Now what I need to do is return to file, and I need to set the submit options for the form. When a user fills out this form I would like them to save it to a share point library. And it's asking me where the library is and I'm going to say, "Well, it's that library". And this is every place that I have been at all, so the document library is here, and we called it Mentor Reports. And now it wants to know what it should call this particular file. If it names this form, then they'll all be named form, and only one person will be able to save one because the second one will also be called form. If I allow an overwrite, the second one will overwrite the first one. That's not an answer. I need to create a file name, therefore, that will be unique. So, I'm going to use the con-cat or con-cat nation function to be able to create a unique file name. So lets click f of x, we're going to start by inserting a function, and it's con-cat which combines text strings. And it says double-click to insert a field. Well, we'll start with the mentor name But, one mentor could have many mentees. So mentor name alone is not enough. Let's go ahead and add our mentee name, and I'm going to delete this final field. I don't need it. Now. Let's say that Mark Lecee was going to serve as my mentor. This would then say Mark Lecee no space Jenny Quarter. I actually need to have a space and a dash in here. And I need to put that in quotes. So I'm going to click between these two fields. I'm going to put no period A quote, a dash, another quote, and I actually want a space on either side of that, and I have to put a comma at the end. So what I have is concat, mentor name, comma, a quote, a space, a dash, quote, and mentee name. Now I want to make sure this is going to work. I click verify formula. It says it doesn't have any errors. I'm good. So I'm going to say okay. That's my final name. So assuming that the mentor mentee relationship is unique this should work. I'm going to click next. This is a share point library submit. This is the default submit connection so when a user says, I filled this form out, submit it. This is where it's going to go by default, and I'm going to click finish. So now I've finished publishing my form, changing the submit options. So now I am going to quick publish or republish my form. To exactly the same place so it will have the submit options. And again, this may take a moment. The more things that I change while I'm working on the form, the longer it seems to take when I do this. So let's open this form in a browser just to see what it looks like. And I can Choose a date. I could have set a default for this as well. And, let's say for example, this is Mark LeCie and he is the CFO in Finance and Mark is mentoring me, he's not really but My email is, and my title is CTO. My department is technology. And, again, we could have drop down lists that we based on other lists in the SharePoint site in exactly the same way. That we would create drop-downs, and any of the other forms we have looked at. But there we go. And I can save this locally if I wish and if I submit it if I want. And if I submit it, it saves it to sharepoint just like this. So there's the name of the file, marklacie-ginicourter modified by me a few seconds ago Mentor. Department mentee email and so on.

This is how we can create a form to be able to capture information. Every time someone says they want to create a new item it opens up this same form. They can create what they want. Print if they wish and submit. And now, I have standardized information coming into a library so I can create work flows to manipulate the information that I get coming in through the form.

Using Email Notifications

Emailing the Submitter

Earlier, we created this library, Mentor Reports, by creating a form InfoPath, and now we'd like to create a workflow. I can start in SharePoint Designer, but I can also decide that I'm in my library right now, why don't I just go to create a workflow in SharePoint Designer.

Here are the properties for our Create List Workflow.

Change the Stage 1 name to Email submitter and mentee.

In this stage, insert an action called Send an Email.

Click on Email these users to open the Define E-mail Message dialog.

On the To: field, click on the address book icon to open the Select Users dialog.

In the Select list, locate and select User who created the current item. With that highlighted, click on the Add >> button to copy it to the Selected Users list. Then click on OK.

The To: field should now say Current Item:Created By.

On the Subject: line, click on the Build button (...) to open the String Builder dialog.

On the String Builder dialog, enter the value 'Mentor Report Received' and click OK.

In the body of the email message, use the following:

Your mentor report, [%Current Item:Name%], was successfully submitted.
Use this link to view or modify your report:
[%Current Item:Encoded Abolute URL %]

This email was generated by SharePoint.  Please do not reply to this email.
  
Click on the OK to save and close the Define E-mail Message dialog.

This is how we send an email back to the submitter.

Emailing Other Recipients

We're in the middle of creating a workflow to be able to email the submitter and the mentee. We already have email submitter done. Now we can add another action, and this is how we're going to email someone who is not the submitter of a form. We're going to choose Action, Send an Email. Click the these users link. Click the select Users button. And if we want to send it to a hard coded email address, we would type that email address in right here. So if I wanted to send an email to a specific person, for example, Mark LeSee, every time. Maybe he's, needs to know something about this. Or I'm sending an email to the director of HRs. So I could type her address in. And just hard code it in, and click, Add. So that's one method. I can hard code an email address. And you'll want to keep track of that method, because we're going to be using that later in the course. The other thing I can do, is I can say, well, I want to email the mentee. I have their email address, because it's actually in my workflow. So, I could choose Workflow, Lookup for a user. You double click, choose Current Item, and I'm going to go grab the Mentee Email that I asked for. Right here. And say OK. So Current Item, Mentee Email. And then I'll fill out all of the other information. I'll provide a subject, I'll provide text for the body of the email. Right now I'm simply going to say, this is a Mentee Email test. Leave this blank and say OK. But, Current Item, Mentee Email, is who this is going to. Another possibility is, that I want to send this to somebody who's on my SharePoint site. And in that case, what we can do is we can send an email, to these users. Choose Select Users, and I can go find somebody on my site. So I'm going to double click, and look for a particular user or a particular group, and see if I can find them. Now I don't have Mark on here, but I believe Jaryl's in our site. There she is, right there. Our CEO. And I can just add her, just like that. So, people who are on the site, this isn't going to search my entire server. Somebody who I've got their email from the workflow. The user who created the current item. And then we have the ability, all the members of this site, all the owners of this site, all of the people who can visit this site. These are different groups within the site. So if I want to have a process where I'm emailing everybody in the HR department that we have a new mentee-mentor relationship, I would then choose, Everyone. That's everyone in this site. That might be a lot more people than I want to send it to. Everyone except external users, so only people in our domain. We have lots of choices here that, that are really pretty interesting. Here's everybody who's on our Active Directory. The odds are good that if you're making choices like this you're probably choosing too many people. But groups within my SharePoint site, individuals within my SharePoint site, that all works really well. When you're all set, just say OK, and here's my email. I don't want my NT users, I just want Jaryl. And I can again create this email and fill it out. So, three good solid ways that we can do this The person who submitted the item. An email that I look up because I've asked for it in the form, or in the view, and somebody's actually typing in an email address. Someone I'm choosing from my Select Users group, or groups of people that I choose in exactly the same way. And then finally don't forget, you can always hard code in an email address, if you need to do that. These are the different ways that we can email individuals within a SharePoint workflow.

Retrieving an Email Address from a List

When we're creating a workflow and sending an email message, it's great if we know ahead of time who we should be addressing that message to. For example, in the first stage, we knew to send it back to the submitter. And we can grab that information very easily out of our sharepoint item. We know that Mark is the Finance VP. And we know that Carol is the h r v p. Those are known’s. The one that is unknown is the area v p review. And I need to comment here that we are going to need to do a look up out of the department’s list in order to get that information. So, I want to show you how you retrieve and email address but you could be retrieving anything. What we're basically doing is creating a look up similar to a look up that you might create in Microsoft Excel. We're going to say, we have a value here. We're going to take our value, go to another list, look for a match to that value, and then retrieve another column. So I have a customer number. I'm going to a list of customers, find that same number, and pull back the customers address. Pull back the customers tax rate. Whatever it is we want to pull back out of a different column. That's how this works. And of course it is a different column. If it was the same column we wouldn't need to do a look up. We already have the information in the matching column. So what we are going to do is email these users. And click to. And if we want to look up information, we're going to use workflow look up for user, and click, add. This is the same dialogue that we saw when we chose for example, the user who submitted the form. Or we want to look for a particular piece of information within the current item. But we don't want to look in the current item. We have a list of departments that has the information in it that we need. And I want to show you that list in SharePoint real quickly. So here's the department's list. It has the following fields. Department, which is the name. The full name of the director. And in some cases that's not occupied because we're actually emailing, for example, in the case of marketing, we're sending this to in box, essentially, for the marketing department, not to the director of marketing. But this is the directors email the title of that director if there is one an organizational area and whether or not this is an active address. So this list has a different purpose somebody else is maintaining this for us that's great. So when we're looking for a list that we can grab information from for a workflow, we want to know that that list exists, that no one will change it's structure without letting us know because for example, if someone decides to rename these fields it might give us an issue. Or if they decide to delete columns, we'll definitely have a problem. So, a known list that somebody's maintaining. If we don't have one of those, we'll create that list ourselves in Sharepoint so that we can make sure that the information that we're relying on for our work flow is solid information that's well maintained. Let's slide back over to Sharepoint Designer now. And we want to do a look-up for a person or group in that department's list. So there are a whole bunch of data sources here. Everything that's in share point, the current list is just part of it, but we have the history and task list that are set up for the work flow, we have our documents library, or menta reports, but here's departments. We're going to grab it right here. And it says, at the top, the field to retrieve data from. So, in the departments list we're fishing for an email. These are the fields in the departments list. And we want director email right there. And it will come back as a string. So that's cool. We're going to the departments list and grab in the director email. But how do we know which one we want to bring back? Well, that's what we're going to set here in the Find the List Item section. We're going to say that we have a department name. Right here, so we want to search through that department column. And the value we're going to place on that is we're going to look in the current item for the department. So let me be clear of what we're doing here. We're saying that in the department's list, we want to return the director's email. And we want the row, or the record, where the field department in the departments data source matches the field department in the current item. Looks good to me. Now, it's possible that there are multiple email addresses for the same department in the list, there is no in forced uniqueness on the department name, because of that when I say ok, share point designer is going to say the look up that you defined is not garunteed to return a single value, in other words some body might have added 5 email adresses for the sales department. And it says if more than one value comes back, I can only send an email to the first one, is that okay? And I'm going to say, yes it is. I might want to actually enforce some uniqueness in that department's list, but it's not my list, so I have to have a conversation with whoever owns that list and make sure that that would be fine to do, and that they'd be happy to do it for me. So I'm going to say okay, and there is the director email for the departments. And we of course then would continue entering the information for this message. We have to at least enter a subject or we can't even save this form. So you have a have a new position request to review, you would put some more information in it, maybe the name of the position, you put an encoded absolute URL here. Everything else, but all of those things we already know how to do. What we need to know how to do here is how to go grab a piece of information using a look up and that's what we've done.

So, we're using email in exactly the same way as when we emailed the submitter and exactly the same way we would for example, if we hard coded an email in.

I want to make one more point about this before we leave. There's a huge benefit to having this table, rather than typing in email addresses. So even though we know Mark Lasee's email, and we could go click on these users and type his email in, down the road in the future if Mark is transitioned to a more important job outside of finanance or if Mark decides that someone else in finance should be taking in this information. Maybe that the way that they're way doing this in the marketing and sales department where they're sending to a departmental inbox is better than all of them flooding into his inbox. If the email changes and we've typed an email in, we've entered it or chosen a person then what we're going to need to do is come back in here and modify our work flow. So, we've entered Mark. And he's right there. But now I'd have to modify the workflow. So there's a benefit to me to look up ever single one of these. To actually have a table either an agreement that that department's table has the default contact that can be to use not just to reach the department but for work flows as well. Or to set up my own list of departmental work flow IDs. Perhaps it would be good for all of my work flows... Maybe only for this particular workflow. My workflow will be much easier to maintain if I have the choice to simply go edit a list and change the email address, rather than needing to go into not just one, but perhaps multiple workflows to say. It's not actually Mark Lesee getting these anymore, it's finance at inside NOI, so something to consider, even when you know the email adress i think you are better off looking it up, because it makes your workflow far more maintainable.

Using Outlook Rules to Manage Workflow Messages

If you're thinking that this doesn't look like SharePoint Designer, you're correct. Here we are in Outlook. When you begin creating work flows that use e-mail messaging for your users in the business community, they will start getting more e-mail than they probably imagined at first because it's usual to have our work flows send a message that says, for example, this work process is at an end. And now so you, the HR Director, can just know that it's done. Those kind of, we got your message. We got the item you submitted. Those routine emails that we're sending, because they're part of the good process, but that doesn't mean our users want to spend a lot of time with them. And if you have key business users, business champions, that you're working with, who are going to get a lot of emails, it's good to have a strategy for how they can take the emails that come out of SharePoint that are more routine, not that important, and segregate them so that they don't have the kind of primacy in the inbox, that you want to afford things that you really do need to take action on. So again, you probably already know how to do this, but let me put the pieces together and make sure that you're really comfortable with it. This particular email is coming from our HR site. And it's coming from the Documents Library to say there is a new document. This is just a courtesy email to the person who needs to monitor that particular folder. So, I got this as a copy. It actually was originally sent primarily to Carol, who needs to know that this document's there. And so I'm getting a feel for what she's going to see. If we had some body upload 50 new documents, she's going to have a lot of emails. And while she does need to know about this, it's not neccesary that she read every single one of these, so let's create a new folder, some place in the inbox, just go create a new folder. And I'm going to call this folder SharePoint WF, for SharePoint Workflows. And if I had a lot of workflows that were different, I might even create a very specific folder that says that this is from the HR Doc Library Workflow. Works for me. Now, I'm going to go to this message and I can right click and begin to create a rule, but it won't be everything that I want. Now, right now, Human Resources is my SharePoint site that we're working in. So, I could say, always remove messages from Human Resources. And I could put them all in this SharePoint workflow. But what if I have some items that would be coming from the document library and some other items that would be coming as a result of our workflow process for approving a new position, perhaps some others for our employee onboarding process. So, so you begin to see that we may want to put these in different folders, it really depends on, on your user's needs. If I'm always moving all of those messages, then I can simply choose always move messages from human resources, and say, put them in SharePoint workflow, and that will take care of it. If I want to be a little bit more granular, though, I need to, rather than accept this high-level move messages that are coming from the SharePoint human resources site, to let's create a rule and be more specific. So I'm going to say, it's coming from human resources, my SharePoint site, but I want to say that the subject contains new document, and I can have one part of this string or the other here. I could say the subject contains in HR documents library. That works. When that happens, move it to the HR Document Library Workflow Folder. I could also play a sound, show a new item alert, doesn't matter. That works fine for me. And I'm going to click OK. It says, this rule, human resources, has been created. I'm thinking, I don't like that name. Well, we'll go back and fix in a minute. I'm going to run this rule now, and message is already in the current folder, and that gives me a great way to check this, because it should move it. And indeed it did, right here. Now, notice that this folder is now three levels deep. And if I'm just looking at my inbox, I'm not going to see it. And if I just open up SharePoint workflow, I then will see it at that point. Let's mark it as unread again, just to make sure that we're still seeing that one here. So, if I want to make sure that I know when new items come in I could add this library to my favorites. And, I would be able to see every time there were new documents here in the HR Doc Library work flow folder. In order to change the name of this rule so it's not just human resources, I can click on the ribbon on the Home tab, go to Rules, manage my rules and alerts. And say I'd like to change this rule, I want to rename it, and this is, new doc in HR doc library, okay, that's great. That's my rule, and I could include if I'd prefer, I could say move message about new doc in HR doc library, whatever I want to call it. I don't simply want to name this Human Resources. We're creating a lot of workflows in the HR site and I want to be more specific about what these rules are because I'm actually going to be using this system myself to be able to track how the workflows are working early on. That looks great. I'm going to say OK. So remember that this process of creating a folder and moving items from your inbox to a specific folder is something that you can easily show to other folks in the organization. Just direct them to this movie in the Lynda.com training library and say, go take a look at that. That would be a good way for you to use rules to manage the emails that are coming to you out of SharePoint. So you get to set what the text is of the subject of the email. Use the rules in Outlook to match up with these subjects and create unique usable subjects. If this simply said new document, that wouldn't be usable. But the in HR documents library, that's something that is unique. And because of that, we can create rules in Outlook to match up with those subjects in the work flows. And create a really nice system that will help your business folks stay engaged and not feel overwhelmed by the messaging coming out of your work flow system.

Using Other Core Actions

Pausing a Workflow

Two of the core workflow actions involve pausing, either pausing for period of time or pausing until a particular point in time. This is different than waiting, when we're waiting we're waiting for something to actually happen. When we're pausing, we're pausing for some duration or until a specific point. You'll find both of these actions in the core actions, right here, Pause for Duration or Pause Until Date. When we choose to pause for a duration, I simply click pause and then I can choose how many days, how many hours, and how many minutes I wish to pause. And let me tell you why I use this, there are lots of times that you take one step, and if you immediately, in the next microsecond, take another step, it creates in issue for SharePoint because it's still doing the first step when the workflow is asking it to do the next step. A prime example of this, is when I want to move an item from one list to another. Now to do this in SharePoint 2013, we actually have to use InterOp, because the ability to copy another item on a list, has been removed from the set of core functions and SharePoint 2013, but I can still reach back and run those commands out of SharePoint 2010 workflows. So, the way I move something is I copy it first and then I delete it where it is now. That makes sense. That's how moving works in Windows. I take an item, I copy it somewhere else and I delete it, we just call it move. But, if I immediately delete as soon as I have copied, that delete will never happen because the copy is still actually engaged. So, SharePoint's in the process of copying an item, I say delete it, and it can't because the item is in use. I want to create some time between the copy and the delete. And what I'll do then is I'll pause for just five minutes, which is the default. It could even be less time than that. We're really talking about micro seconds here. Pause until a specific point in time, on the other hand, or until a specific date and notice that I have this time, this date, and I have a builder that, I can say, a current date or a specific date and time, I get both of those. Is used when I want to say, right now in this workflow, hang on, and then, what we'll do, is, when the clock hits this particular time and date, the work flow will continue. So you would use pause until a specific date, or pause until a specific point in time, if, for example, we wanted to send a notification out the next morning. And we could actually calculate the date for the next morning if we wish. And so it's really easy to use either one of these. The one is used to be able to simply create a pause in the workflow right here. And the second is to actually wait until a specific time when the calendar clicks by. So, you'll use these two pauses as you need to in order to, for example, set a reminder in this case. We're going to email users. We're going to pause for a day. And then, we will send them another reminder. There's no reason to send them an email and immediately send a reminder. We'll wait for a day in between. Or, use them to slow your work flow down for five minutes, and that allows you to keep things synchronized with SharePoint.

Understanding Workflow Variables

One of the core actions is an action that is called Set Workflow Variable. So, let's understand what a workflow variable is so we'll know when we might want to set it. Workflow variables are used to create memory spaces that you can use to hold a value that you will want to use later in the workflow. For example, we might ask our user to provide some information and we need to store that somewhere. We'll create a workflow variable to store it in. Another possibility is that we want to create a calculation somewhere to be able to calculate a particular point in time, a number of days, a cost. Anything we calculate that we want to use either has to immediately be placed into a column, or stored in a workflow variable. There are a couple of different ways to create workflow variables. One of them is using the set workflow variable command. And when you do that, you'll actually go into the workflow, and you will click Local Variables. And add a container for our variable, right here, so we'll add workflow variables and we'll specify their types. This is a great way to do this because you get to control what these variables are called, and you can be very clear about how you're doing it, so it's a very explicit method of creating variables. So if you were going to calculate a total cost, you'd create a local variable and you'd call it Total Cost, for example. Now you can come back and modify the variables if you wish, if you forgot to type it correctly you can go back into local variables and modify it. Or if you left the default string but you meant to use number you can go back and you can modify the type. And they're also removable if you decide you don't want them in the workflow any longer. You might start by creating a local variable, but then, because your users want to see it and they can't easily see workflow variables, then we could create a column in our list or library, and explicitly store the results of that variable there. Workflow variables are used a lot, and they're not simply used with this set action. There are other actions within SharePoint workflow, that use workflow variables, so let's take a look at those. The first, of course, is that workflow variable where we have a purpose, and we very intentionally create one. But if you use some of the list of variables. For example, if you use Create List Item, SharePoint will actually create fields to store the items in. Local variables until it can create the new item. So you’ll providing information. SharePoint will be taking it in, stuffing it into new variables. And then it will use all of those to create the list item. If you do a calculation, the results of that calculation have to be stored somewhere. Even if it's only for a microsecond, SharePoint needs someplace to put them. So SharePoint will create a local variable if you have not. And the same thing is true with date time calculations that we can do. For example, add a time to a date. There has to be a place to store both the date and the time. And so two local variables will be created for that. Anytime we collect any data, any place in our workflow that we don't have a field for. And then finally, all of these utility actions that are actually similar to functions that we have for managing strings in Microsoft Excel, and doing date calculations in Microsoft Excel. We're extracting sub-strings from the end of a string, and that sub-string needs to be stored somewhere. Again, a workflow variable. If we want to find an interval between two dates, then that interval will be stored in a local variable. So workflow variables, whether we create them ourselves by explicitly saying we want to make a local variable. Or we have SharePoint create them by using an action that requires SharePoint to create one, all of these are temporary spots that are used for SharePoint to store information that save you the trouble. Of providing a SharePoint column or a form field to store this variable information in, until it's needed.

Overview: Order Business Cards Workflow

The next few movies are going to use a workflow called, order business cards. And it's a great workflow. We're actually starting this workflow by looking at the outcome that the business wants, and that's a great way to do this. They want to be able to have people enter their orders for business cards. Right now what happens is, somebody wants a new business card, they pick up the phone and they call HR or they send an email to somebody. And then there's the follow-up calls, when will I get my cards? And it's a perfect self-service type of workflow. Self-service meaning that the person that wants to place an order can do it themselves. So, after the business cards have been ordered, the email that goes back to the person who ordered them should look like this. And I've created this email and highlighted the fields that are variables or pieces of information that the user has entered when they filled out the list. It says, your order for 500 business cards for this particular person has been received. The cards will be shipped to the office that was chosen, on the ship date that was calculated, using UPS two day shipping. Your expense budget will be charged an amount we calculated based on the order size at that time. So this is what the email looks like. Getting to this email then, is what the process looks like. So, we need to create a list. And I've already done that. I've also saved an Excel version of the list with some notes to make it relatively easy for you to create the list if you wish to do so. So I'm going to switch over to Excel right now. And you will find this particular file called Order Business Cards in the exercise files for Chapter nine, it has your columns across the top and a table with one record. The record of my ordering business cards, which was what we saw that email from a moment ago and then down below, whether or not it's required, what type of data, single line of text choice and in this case, these are where the choices are. Here we're going to do a lookup to a departments list. If you haven't created one of those already, you might want to create one for this workflow. And then we have a choice list here that is simply being entered in the form for right now. So, you can use this to be able to publish the table, if you're not familiar with this in Excel, it's really pretty easy. You say you'd like to export this to a SharePoint list. And then you'll be prompted about where you would like to put that. And it will give you a list, and it'll have one record in it, and that's just great. Let's take a look at what the list looks like then, that I created. So let's switch over to SharePoint. Here's our list, which you just saw a moment ago. But it's easier to see when we open up a new form where a user would be entering their information. There are a lot of required fields here. You'll notice that they have asterisks. So we're getting the email address of the person who is placing this order. Remembering that, that many people might have somebody in their department order cards for everybody. An administrative assistant or somebody who's in charge of making sure that all of the appropriate business cards have been ordered. The person chooses a quantity and there's the full name that they would like to have appear on the card and that might include things like, you know, a degree, and MBA, a doctorate. Whatever we want to put under full name. Job title as it will appear on the card. A department, an email address, a main phone, an office phone, a mobile phone, a location, and we will get the mailing address then for that location when we print the cards. And then, optionally, we're allowing users to be able to put their LinkedIn or Twitter names here on their business card. That's what this looks like. So, in order to be able to generate the email that we saw earlier, we're going to need to be able to calculate how long it would take to be able to print the cards, so that we can tell them when we're going to be sending them, and what the charge-back amount is for the budget. So we will need then, to be able to store two pieces of information. A charge-back amount, and the date on which this order would be completed and ready for shipping. Perfect reason to use local variables, and we're going to create those ourselves so that we can name them with names that we want to use in the workflow. Let's create those variables then, in the next movie.

Creating Workflow Variables

I need to be able to create a workflow so that I can create local variables associated with it. There is no such thing as a local variable without a workflow. So, my business card orders list has been created, you saw that earlier, and I've started a workflow called order business cards. And I've renamed stage one so it says order received and now I want to create a local variable. And, this isn't something that I do in here. I do it, here on the ribbon, and I need two of them. The first is where I'm going to store the amount that we are going to charge to the budget of the person who these cards are for. So we could call that charge back. And that's actually what is known as in the business. And then I'm going to choose a type. You'll notice that my type list is much shorter than what we're used to looking at. And I have two choices for numbers. I don't have a currency choice here. What I really need to decide, is one of two things. Is it going to be a whole number only? In which case I can chose integer. And I can't promise, even if right now they're even numbers, I can't promise that it won't be an odd number later or a number with some decimal places. So, I'm going to chose just number. That's the safe thing to chose for currency and say OK. There's my first workflow local variable. My second is I need to have that date that we're going to ship this item. So, a ship date. It could also be called a delivery date, but then I'd have to add two days to it, and I might want to be able to do that later. One of the possibilities down the road is I might be able to overnight things if people wanted them more quickly, and then I have simply one day rather than two, and I'd be able to show them a delivery date. So let's call this ship date or shipping date, either of those will do for me. And it's pretty clear what my choice here is. It's Date/Time. I'm going to say OK, and I've created my two local variables that we're going to use in this workflow. And we'll see how to use each of them in the next two movies using two different workflow actions that use local variables.

Calculating with Numbers using Do Calculation

The next action that we are going to use is the Do Calculation action. Anytime we would like to be able to do a math calculation. And this is adding, subtracting, dividing, multiplying, and actually doing modular division as well. We're going to use Do Calculation. This is not what we would use if we wanted to work with dates for example, or text strings. But we want to do basic math with numbers, we're going to use Do Calculation. So, let's choose it from the list and it says calculate value plus value output to variable. Let me quickly tell you what's happening here. We have three things that we can change, plus, minus, etc. I can choose the two items that I want to do an operation on, and then, what's happened is, automatically, SharePoint has created its own variable called calc. But we actually want to use a variable called chargeback. Now remember we have two local variables here if we take a look at our list. And also there's this new one that just got created by SharePoint. Ship date doesn't show up on our list. And the reason it doesn't is that the output of this operation has got to be either an integer or a number. And so, only variable shows up from our list. Or we could create a brand new variable here if we wished. So, we're going to do a mathematical operation and store it in a variable. So let's look in our current item and go find the field that's called Quantity. Now, notice I scrolled to that. What I would normally do here is I'd just hit the letter q, and it would take me there pretty quickly. So, I'm going to take Quantity, and then I'm going to multiply it by the cost. Right now, we are charging a nickel for every business card that we print. That's how the cost gets calculated. We could choose to have a table where we look this up. We could choose to actually have a parameter, another type of variable that we enter at the start of a workflow. So, that this is something that can be changed a lot. But, we're simply going take the easy route here and type in 0.05. There's our nickle. So multiply our quantity by 0.05. Now this would actually be a really great action to comment. So I could add a comment first that says that the current cost is 0.05 for each business card. If this changes, change the calculation below. Looks good. There's a comment. Now, output this to chargeback. Notice we don't want to have variables called calc, calc one, calc two and so on if we can actually have variables that make some sense to us and to the people in our workflow. So that's how we do a calculation. This is really pretty easy. I want to point out one more thing which is that modular division. Plus, minus, multiply by, and divided by. I'm sure you have a handle on all of those. What mod is, is it is the remainder left over when we divide one number into another. For example, if we are packaging items on pallets, and a pallet will hold 10 cartons and someone orders 12 cartons. Then, we would divide the 12 by 10. And, there would be 2 left over that would have to go in a separate pallet. That 2, that left over, that remainder, is what you get with mod. So, mod is often used in things like warehousing, fulfillment centers, where we need to be able to know how many things can be placed into a container. Another place that we see mod used is in systems that make change. So if we're giving someone 99 cents back in change, we would first divide by 25 and find that we were giving them three quarters, but we had 24 cents left over then that we'd be giving them in nickels, dimes, and pennies. And that 24 cents that's left over is indeed mod, so if you need to know what's left over then that's what that fifth operation is under Do Calculation. And you can find out more about this either in Excel, which also supports mod, or in the help files online for SharePoint Do Calculation.

Calculating Date and Times Using Add Time to Date

I've made a couple of other changes to my workflow just to provide a little more structure and clarity. So the stage was called Order Received but then I created a step for Calculate Chargeback and another step for Calculate Ship Date. And you can move actions up and down and therefore in and out of steps, just like that. So I'm going to move this action up and move this action up and they are now both a part of Calculate Chargeback. Now I want to calculate my ship date and we're going to use yet another core action to be able to do math with dates. The action is called Add Time to Date. And the name is interesting because it makes it feel like there's already a date there and we're going to tag a time onto it. So it says January 1st. We're going to say, oh, 10:00 AM. But actually, you can think of this as adding times to times, dates to dates, and so on. Any time we want to do math with times or dates, this is where we'll do it. So I'm going to choose Add Time to Date and we say that it takes us seven days to be able to print. No longer then that ever and so we have items ready to ship maybe in five days or in three days but we ship them in seven days. These aren't business days, these are just days. And, we want to add this to something, so what do we want to add it to? Well, let's go into the current item and find out when this order was placed. And, we'll know that because it's actually the created date right there. And we're going to output that to, now again, SharePoint created a variable. It created a variable named Date. But we want to actually use our Ship To Date variable, that we created ourselves. So there are now two variables that were created by SharePoint that aren't necessary because we're using ours. And these are better names. We don't want one called Date or Calc, we actually want Ship Date and Chargeback. One more thing about local variables. They're local and, and they're temporary. So if we don't do something with these variables and the workflow ends. The memory space created to hold Chargeback and Shipdate is cleaned out and these values are lost forever. So, we will always want to make sure that we are either putting them in an e-mail where we want them to go, that we're writing them to a particular column in a list, or that we're adding to meta-data for a document in a library. We need to do something with the variables because any variable that we don't store somewhere. More substantial than a local variable will simply go missing at the completion, or the termination of our work flow.

Completing the Order Business Cards Workflow

Before we continue, we're going to knock the rest of this work flow off. There's not that much more to do to it. We end up having three stages. The first is the Order Receive Stage. The second is the Printing Card Stage. And the third is the Card Shipped Stage. And, I'm giving these names that describe the functionality that's happening at that time because, I can very easily report out stage names. I can't easily report out my step names. So, these are more internal if I wish, but I want to make sure that things like order received, printing cards, and card ship. Are things that my users, my user community will understand. What I want to do after I've received the order, is make these two calculations. Yeah, and that takes microseconds. And, then, the next thing that it's time for me to do is, to actually send that email. I can do it in this stage, but it would make more sense perhaps to do it in the printing card stage. So, what I'll do, I believe, is take a pause. Just a short pause because otherwise order received is never going to show up. So it makes sense to do a pause for a short duration at least. Here, maybe 15 minutes for example. Or even a day. We're probably not printing cards for a day. We're going to pause for one day. And I'm actually going to move that up, because I would like that to be part of, this prior stage. I don't want it to say we're printing cards on the first day. So let's just move that action up. We've done the calculation, and we've paused for a day. But, before we pause, let's send that email that says, we got your information, and we're going to be printing your cards. So, the action here is an action we've used frequently, which is the Send an Email action, Email These Users. Well, in my workflow, I actually asked the person who wanted to be notified to let me know. They're not necessarily the user who created the current item. We have an explicit call out, that says, who is it we should be notifying. Right here, so that notification email, was entered by our user. And that way we might have one person ordering, but wants someone else to be notified, and get the email back. And I'm going to now open up a document, that you will find in your exercise files, that is the text of what we want to place in this email, because this is the text that was given to us by our business users. If you're creating workflows for the business, you want your business users to actually create the text that will be being used. There's no reason for you to necessarily be doing this, because the emails are coming from them. It's their processes. So I'm going to go to the desktop, and I'm going to open exercise files, and in chapter 9, there's the order business cards confirmation email. And I like that. It says the text below is the body, highlighted fields will be replaced with column values or local variables. Feel free to change any of this you want to. I just want to grab this text, to make my life pretty easy. So I'm going to copy that. And now we'll go back to Sheerpoint designer. There's my text. And it's really easy now for me to be able to put my look ups in. So I'm simply going to simply delete that, and go to add or change look up. And I know that that was my quantity. Just hit the letter Q. There we go. Your order for the current item quantity business cards for, and this is going to be the full name, of the person the cards were ordered for. So again delete these if you don't want them to be highlighted in your email. You might want them, that would be fine too. Current item, and this is called, Full Name. Has been received. These cards will be shipped to. This is the location column. Right there. And this, is our ship date, which is a local variable. Now you'll notice, it doesn't show up here on our list. It's not part of the current item. That's what's stored in our list. This is a workflow variable. Shift Date, and it's coming back as a string. That's cool. Now, we have choices about how this looks, so if we like it to be explicit, and to say, the name of the day, that kind of thing. We're going to use Long Date or String. We can try S String first and see if we like that. We can always test it and change it, and your expense budget will be charged. And again, this is not in the current item, because it's not stored. This is actually, our local variable, called chargeback. So, there's no point in looking here. Let's go to our workflow variables. There we go, and the charge back, let's format it for currency, isn't that great? Your order for the quantity, would have been entered by the user, for the full name, entered by the user has been received. The cards will be shipped to the location, entered by the user in the current item, on the ship date that we calculated and stuffed in a local variable. And the expense budget will be charged the charge back amount that we also calculated and placed in another local variable. That's cool. Now, we could have as a subject your business card order has been received and that would work for lots of people. But let's imagine a setting, where we have just on-boarded 20 new people in an area. And one of the administrative assistants was assigned to make sure that all those business cards were ordered. And all of them are coming back to her, she's the person being notified. Well in that case, it would be helpful to have a little bit more information. So, we're going to actually say, your order for business cards for this person has been received. And I can copy this if I wish, right from here. And I can go into the builder, and I can paste this with Ctrl+V. Now I can't simply use this field. That's really not a good idea. Every time that I copy and paste fields, I'm better off deleting them, and actually going and using the look-up. So in this case, this was our order for. And we don't even need to know what the quantity was. That's what that text was, so let's just say your order for business cards. And I'm going to delete, the full name. And we're going to enter it again. So your order for business cards for this person has been received. We could probably make this shorter even. That would be more beneficial, because more of it would then show, in the information viewer. Business card order for, has been received. Okay, perfect. Okay, there's our subject. The business card order has been received. This is exactly the email, that the business wanted us to send. I missed the boat by not making them tell me exactly what they'd like to have in the subject. But you know if they just said, business card order received, I would actually think that I would put more in here, even if they didn't specifically ask for it. We want to make sure that Carol Tyson signs off on this email because it's going out over her signature. But this looks good. We could do a dear, first name, full name kind of thing. But we didn't ask for those fields. All we know about the person who ordered this, is their email address. We don't even have their first name, in this particular list. It's not that we can't get it. But, we don't know that the person who wants to be notified, is the person who placed the order. So, we're good, this is great. It's going to do everything we need it to do. So let's say OK. So, we could have another step here, that says email. And this is a big step, so why not? Let's go ahead and add another step. 4 was the first number that hadn't been used, so that's fine. Now we're going to say, send confirmation email, then pause. That's a great step. Now let's pop both of these things up here. There's our Send Email action. Move it up. Here's our Pause. Move it up. So we're pausing for a day, but we're really not, because there's nothing here that is preventing the work of the printing from going on. It's just that we're going to pause a day before we changed the status, to printing cards. And then, what we want to know is, we want to know when the cards are shipped. Well, that's the variable-ship date, right? So, we have a couple of possibilities here. One possibility is, that we actually have somebody go into the list. And enter the date when they ship them, and perhaps their initials, and so we know that they're shipped. And that would be our best approach. The other possibility is, that we simply count those 7 days, and mark the cards as shipped. I'm a little less comfortable with that. I'd like to have that 1 more column, where we're actually asking somebody to enter some information. Up to you. If we think that this is pretty much on auto-pilot and the cards are going to be shipped within 7 days, we could just call that variable up right here. And all we need to do then is wait, until the ship date. We have the possiblity of doing that. So let's see what that would look like, just so we know. So, we're going to say we're printing cards until, and there's our other pause, pause until date. That says when, and we're actually going to go get it. We're going to do our workflow look up, and we're going to go to our variable, and we're going to choose Ship Date. So, we're printing the cards. Until the ship date, and then we're going to go to card shipped. We could send another email here if we wish that says your cards have been shipped. I would normally have a process where somebody would actually have signed off that they put them in a box, and put 'em on a truck. It's kind of interesting to have your workflow reporting work when we don't actually know that it's been done. So, we're going to simply add a comment here, that says they want a confirmation email. If so, lets add a column, so HR can report shipping. And of course if, if you're used to having items shipped you know that another nice thing we'd want in that email, would be here's your tracking number from UPS. That's our whole work flow though. It is all done. I'm going to Save it. I'm going to check it for errors. And there are no errors, so now I can publish it to my server. The next thing we would do then is we would test our work flow. So we'd want to make sure that it was working. We know what list it's working with. We can switch over to sharepoint, our business card orders, and say we want to enter a new item. So I'm going to say, send me the email. And I'm going to order 1000 business cards, for, Mark Lucie. Mark's the CFO, these aren't real business cards, we're just testing. He's in finance. His email address is mlacie. He doesn't want to include the main phone. But I have his office phone there. He's in the Chicago office, and he doesn't want to have his Twitter account, but he does want his LinkedIn. Which is actually just Mark Lacie. And were going to save this. So that's all the harder it is for somebody to be able to add a new business card order. I'm going to refresh this. And our order business cards process, here, has added a column, so that we can see where we are in the process. Now, let's go into our list, and take a look at our workflow settings. And there's our order business cards. And there are no workflows in process. Look at this. None, why? Mystery solved. We missed one setting. Let's go back and get it. If we go into order business cards. Creating a new item will start this work flow, that wasn't checked. This is one place I can do that, where I typically do it is in Share Point Designer. Let's go over there and see where that same setting is. Here in Share Point Designer, if I look at my workflow settings, start workflow automatically when an item is created. I don't actually want this to be manually started. Okay there we go. Let's save again. Notice we're not editing the workflow, we're just editing how it starts, what its options are. Publish it. And we'll go back to our list and enter one more. So, New Item. My new hire. When you're first creating a workflow, sometimes you want to have fewer required fields just so you don't have to fill out so many items when you're doing testing. Notice that I can put anything in these that I want. Except I do need to choose a city, because it's going to show up in my list, and in my email, there we go. So this workflow is showing that the order has been received, that's the stage that it's in. I'm going to click that link, because it will let me see this workflow, running against this item. And here comes the email, coming in to show me that the business card order for John Evans has been received, they'll be shipped to the Ventura office, using UPS 2 day shipping, the expense budget will be charged at that time. So, here's the email. Now, I don't particularly like this string date, and I said we might want to change it, so we'll go back and change that to long date. But I can watch this execute, and know that the workflow is started, and that this is its current status, and its status again, is coming from the name of the stage, and that's one more setting. Let's go take a look at it in SharePoint Designer. In SharePoint Designer, for a workflow. Right here in the settings, where we choose the task list, and the history list. Remember that we can automatically update the workflow status with the current stage name. And so right now, it says, the order was received. After that pause of a day, it's going to say the order's printing. After the pause of a week, it's going to say, that the order has been shipped. So, this is what it took to finish this workflow. That's not that much time, to create something that's going to be very very helpful for the business. And along the way, we learned how to create workflow variables, and use them to do calculations on things like time and date. We have a couple more things to learn about this workflow, but we needed to get to this point with it. So now, the next two movies, we'll take a look at how we handle workflow status updates, if we want to do them in another way, and how we would terminate a work flow.

Setting Workflow Status

While the work flow is running, you have two ways that you can report status. One method would be to use stage names and I'll show you that again although we saw it in the last movie. And the other way is for you to be far more proactive and to actually use an action that sets what the work flow status is. Right here. So, you can say at any point in time change the workflow status to this piece of text. And you can also use variables in that name. Both your local workflow variables and the information that we would get out of the current item or from some lookup. You should choose one method or the other. It's difficult when you have SharePoint updating stage names and you're then updating the workflow status yourself. So, if we go look at the workflow settings, if this checkbox is checked, the workflow status that appears as the custom column that the workflow added to our list or library will always have the current stage name. This is a new feature and I really appreciate this because as long as I'm smart about how I structure my stages, and I use names that would be user-friendly. I can easily be reporting all the time about process and progress in my workflow. But if I don't want to do that, I can turn this checkbox off. And then, what will happen is we'll have a workflow that basically has three stages. The last being Complete, the first being in Process. So, if I'm going to turn this checkbox off, then I want to be able to report status myself. And what I'll do, is in my workflow, it's no longer going to report order received. So, what I'll do, is I'll actually report that myself. And the way I'll do that is I will add an action. Set workflow status. And, you simply enter Now, the benefit of doing it this way, is you might want to have more statuses than you have stages. For example, we might want to be able to have sent confirmation email. You might also want to have fewer statuses than you have stages. So, if the way you design your workflow and the stages that you use aren't necessarily useful for reporting to your users, then you simply set workflow status yourself. This is done on a workflow by workflow basis. This is a workflow setting, not a SharePoint Designer setting or a SharePoint setting. So, you get to choose. Another thing you might consider is if you're working with a workflow that someone else created and they created it as all one stage. And, and, that's not unusual, because stages are relatively new in sharepoint. A lot of us have been creating workflows without stages, only with steps for years and years. So, if you are working with a workflow that's one big stage or two big stages, but you want to report more frequently, your choices are to break it into more stages and name them. But it's probably more effective to simply turn off the stage reporting, that's coming as one of the settings for the workflow. And go in and set workflow status yourself. As many times as you wish, and wherever you wish. It's good if your'e doing this yourself that the very last status you might want to report some place down here would be workflow complete or in this case, CardShipped. We're doing whatever the end state of the process is. We want to report that. But, this is how you would use the set work flow status action if you choose to do your work flow status reporting, yourself rather than have SharePoint do it based on your stage names.

Using Dictionary Actions

Building a Dictionary

There a new type of variable that is available in SharePoint 2013 and I've created a small demonstration work flow to show you about this feature, you do not need to create this work flow. And that variable is actually a container for other variables and it's called a Dictionary. Now, earlier we created a work flow were we did a calculation based on number, another based on a date and we created some local variables to put those into. What I’d like to do instead of creating local variables and then filling in a value. Is I actually want to create a dictionary to hold some variables. And I already know what those numbers are. So, I'm going to begin by saying I would like to build a dictionary. And it's going to create a variable for it, but I want to create another variable, and I actually don't need any of these. I'm just going to remove these, and I'm going to add a new one, and. I'm going to call this dictionary, Rates. And it is a dictionary. So, I have to have a local variable to declare, to hold the dictionary. But after that, and we're going to put this into, Rates. I can build a dictionary. So the very first item I have, is I have a tax rate and it is a number, and it is 0.017, so it's less than 2 %. The next thing I have is I have a banquet rate, and this is the rate that we're going to be charging for food and beverage types of services, it's a markup on top of the actual coast. And this is a number also and this is 22%. We have a room rate and this is a number also and this is actually our guest room rate and it's $89. A night. We have an AV daily cost, it's a number as well. And, it is 235. So, these are the items that are in my dictionary. I have a tax rate, a banquet rate, a room rate and an AV daily cost. If I wish I can come back and edit this dictionary and add more items to it, but now I have a dictionary that's got rates in it. And so having to declare each of these and drag them around the work flow separately. They're all together and in one place, and I can easily go in and see what I have in my dictionary. In the next two movies, we'll see two different things that we can do with other dictionary actions in SharePoint 2013.

Counting Items in a Dictionary

A dictionary might also be a collection of items that are like items. Rather than a mix of different types of rates for example, I could have a dictionary where the first item in it was a particular employee. And then had their name for example, Greg Verden and the amount was Greg's rate. So that I could have a collection of hourly pay rates for employees, the next person in there would be Janet Hayes and it would have Janet's rate and so on. So when I have a collection of like items, or unlike items, one of the things that I can do, is I can iterate through the dictionary and count the number of individual items that are in there. So this is another core action and it's Count Items in a Dictionary. So, I'm going to say then, Count Items in the Dictionary Rates. And it's going to output this to a variable. And you know that variable can be count, which just got created of course by Sharepoint or I can add my own. I might like to even maybe modify the name of this so that instead of saying count it says DictionaryCount. I'd be happy with that. There we go. So, I can build this and then I can count the number of items that are in the dictionary, now remember that we also have the ability to do a loop in a workflow. That does it n number of times. So, imagine now that I want to do something in particular with this dictionary with each of the items in it. What I can do then is I can say that I’d like to Loop n Times through this dictionary, and this says 1. But what I can do is I can say actually, what I'd like to do is I want to loop through this DictionaryCount number. So, now, I have a loop that will happen as many times as there are items in the dictionary. So if each of those is a rate, I can go get the first persons rate, do something with it, go get the next persons and so on. So that's the benefit of being able to do this DictionaryCount, is to be able to say, okay, there are five different employees in here with their rates. Let's go through and iterate through the dictionary for each of those items.

Getting an Item from a Dictionary

In order to use a piece of information, from the dictionary, I actually need to go get it and store it either in a column or in a local variable. So, to retrieve information from the dictionary we'll use an action that is called Get An Item From a Dictionary. And I'm going to say that the dictionary is the dictionary called rates, and we're going to output this to a new variable. And what we want to do is go grab the tax rate. So, we'll call this, and this is a number. So I'm going to go get the tax rate from the variable rate, and put it into a local variable. And then the next thing I could do, is I could actually do a due calculation, using the local variable. Or, I could decide that I'd like to create a new item, and use this tax rate in it in some way. So, three things we can do with dictionaries. We build dictionaries. We can count the number of items in them, particularly if we're using a dictionary as a collection, that we would like to iterate or loop through. And, then, we can go retrieve a particular item out of a dictionary. So, if we were actually doing a loop, we would use these two together. We would run a DictionaryCount number of times, and we would then go get whatever piece of information it is that we would like to be able to do something with within this loop. So dictionaries are a new item. Some people are really excited about them. If you do a lot of work with variables, I think it makes a lot of sense. To start looking at using dictionaries, rather then a number of free-floating local variables in your share point workflows.

Using List, Task, and Utility Actions in Workflows

The next group of actions that we're going to look at are list actions. And when we talk about lists we mean lists like an announcements list or a links list, but we also mean document libraries. Like this library or our articles library. All of these are lists in Sharepoint. And, what we're going to do is create a small workflow to illustrate how we create a new list item, and so here's the setup. When someone adds a new event to our calendar here. In the HR area, where we're going to track our training's our orientations and so on. We want to give our staff the ability to easily create an announcement to promote that event. Now we're not going to make this automatic. We're not going to run it so that every single new event gets created as an announcement because that's probably overkill. A user can subscribe to see the events calendar in Outlook. And they can put alert on the announcements list, but if they're doing both, that's just too much. But I want to give all of our users the ability to easily say, this event deserves an announcement. So, easy enough to do Let's go then to HR events because that's where this is going to fire. Go to Calendar. We don't normally approach this, this way but it works just fine. Workflow Settings > Create a workflow in SharePoint Designer. And remember that we're going to get asked three times whether this is OK. And now we'll add a new workflow to the list. And, let's call this, Create Announcement From Calendar Item. I add that from calendar item mostly because when I look at the list of workflows available, it's helpful for me to know that it's related to the calendar. And again, I can enter a description. And one of the most important things is that this is a manual workflow that allows the user to quickly create an announcement about a calendar item. To SharePoint 2013 workflow, so we're going to say OK. And our first action, that we want to take is to go up to the list actions, and say that we would like to create a list item. So create item in this list and the list we want to choose here is where we would like to place this new item and that's in the announcements list. So it says OK. That announcement is going to need a title. What should we use for the title of the item we are going to create? So there's our value. I can double click and say set the title in the announcement to. And remember that our current item is going to be in the calendar and probably it would be really great if we simply used The title here as well. But I could throw a little text in front of this, so the title would be something like, Orientation Session, or Staff Meeting. And I could add some text in front of that. It says new whatever, just added to the calendar, for example. So the title in the announcement field is going to have this value. Now we can have other items here if we wish. We could add other fields. We could grab other items out of the body, and we can use a, a builder for this as you saw me do a minute ago. So I could create a pretty bulky announcement here, and that would be a good thing to do. So there is my title. And let's say that we want to add then to the body and the value then will open our builder and we'll put on. And in the current item in the calender, we'll go grab the start date. And we might want to do a long date here. This event will be held on such a such a date in. And then will grab the location for the current item. There's are location and string. And that's what will go in the body. So, the title will be New Item Added to the Calendar. And the body will say, this event will be held, and we could determine whether it's an event or whether it's an appointment or a meeting, but that works. This is just a real simple example of creating a new item. Now you might wonder when you're looking for title, body, and so on. You know start time, end time, how do I know what those are called? Well they're basically called the same thing in the calendar that they're called in Outlook. That's true for our calendar, that's true for our context list and our task list. So if you already know what all of those things already are, that's just going to be great. And there's one more thing that I could do that would be sort of sweet. If I go back into this item, I could add a link right back to that item in the calendar. So, I'm going to say here's a link, and whenever we want to add a link to something, we use our encoded absolute URL. So this event will be held at this date and time in this location, here's a link. It's going to help our users jump right on that. So we'll say OK. OK. You created a new list item, OK. Now, what else? We'll change our stage name just' because it's a good thing to do. And remember that we need to be able to say how we're going to get out of here. So, we're going to go to a stage, and the stage will be the end of the workflow. Very simple workflow. Let's check it for errors. All good. Let's save it, and then we're going to publish it. Now were working in an editor or what's called a text base designer in this version of SharePoint Designer. Because we also have a designer that we can use that is not text base that is the visual designer. I'm really in the editor now, I'm going to go back to Create Announcement From Calendar Item which is actually showing me my settings. And this is a really good habit to be in, because if I want to make sure that I'm starting a workflow automatically when an item is created, it reminds me to do that. If I want to make sure that I'm using the tasks, task list and the Workflow History, history list. I can do that here, as well. So, this is good. I can publish this again. I've made a couple of changes. And, it's good to do that. And, again, changing these is something you want to do before you start using this Workflow. .And this is gong to be manual, so, let's go test this and see how it works. We're going to go to our Calendar and, this is again, our Calendar in our HR site, which is called HR Events. And, we're going to put a new training on April 17th. So we're going to add a new item. And this will be in the board room. And it will be held form 11 A.M. 'til noon. We could put some more text in here. Don't necessarily need to, but we could categorize this. It's for business. We could specify our own value, we might like orientation actually. It's not all day it's not a repeating event, so I can save this. Now this is really done nothing so far. I can go take a look at this particular item. And I can say workflows, create an announcement from the calendar item. So I'm just going to go ahead and kick that off. And it's done. Now, why isn't there anything here? Because it won't be here, it will be in our announcements list. So here it is. This was the announcement that was just created. Remember I said new and I had a place for it. And happens to be a new employee orientation that looks like I'm stuttering there. So there's a new, new employee orientation that was just added to the calendar. This event will be help on Thursday April 17, 2014 in broad room here's a link... Looks good. It's all here. So that's how easy it was to be able to create a workflow that created an announcement for the calendar item. Nobody had to enter the same information or copy and paste it. We just took that information out of the calendar item and plugged it right into. The new announcement. That's how you create a new list item in a SharePoint workflow.

Setting Field Values

Earlier we created and finalized a small order business cards workflow. Two calculations were performed in that workflow. They were:

These values were stored in local variables. At the end of the workflow, since the value did not persist, the values disappeared. To get the values, the workflow would need to be initiated again.

It is possible to set the value of a field in a list to persist the value.

Let's add a date to a list that is a Date and Time type. This will be the date when the item is expected to arrive. Once the Column Name and Type are entered, opem the Column Editor. The description will be Forecast date for shipping cards. For the Default value:, select the (None) option. Put a check mark in Allow blank values?. The Display format: will be Date only. Then click on the Ok button to save the changes.

Now we have a place to store the date value. Next, modify the workflow to store the date value.

Let's go back to our business card orders list and, yes we want to save the changes to it. We have a work flow right here that's running. I'm going to click to see it's properties, and click here to be able to edit it. So, right here we're calculating the ship date. And what I'd like to do now, is I would like to say that now that we've calculated the ship date, we want to be able to store this. So we're going to go to action, and this is a list action. And it set a field in the current item. So we're going to set the field that we just created, shipping forecast, to the value of the shipped date variable that we have right here. So let's click the f of x. When I click the builder it's just going to let me choose and this is not in the current item, it's in the workflow variables and parameters. We're going to try to get it in to the current item. And it is ship date that we'd like to store. So after we do the calculation, we're setting the shipping forecast to the variable ship date. Now, even after the end of the work flow, we're not going to lose track of the date that we put in that email and the date that we promised we would be able to ship this order. When we do this, we have to make sure that our data types match. We can't simply take, for example, a string and put it in a date field, or a date and put it in a number field. That's the biggest error that you'll make is that you'll have the wrong type of variable to be able to put into a field and you'll need to go change the field type if that's the case. But that works. That's the action the we use here to be able to set a field in a current list item, whether that list is a custom list, a calendar, a contacts list, or even a document library.

Assigning a Task to a User

Most of the workflows that we create, are a mix of virtual and actual actions, steps that can be automated like sending emails are all electronic. And then steps that have to be completed by someone physically and can't be done by a computer. A perfect example of that is here in our workflow order business cards, where someone actually needs to print business cards. And the easiest way to make that happen is to assign someone to do that task. So, we've been waiting in the printing card stage pausing until the ship date and then saying well we think they were printed at that point. But what we would like to do as, as soon as we have verified that we're ready to send this task to the printer, we want to send it out the door. We don't want to wait until we've paused for a day to be able to send some information. We actually want to receive the order, do our calculations, send a confirmation email and then immediately right here, we want to engage the printer by assigning a task. There are two task actions. The first is assign a task and the second is start a task process, which is the name for this new action, which should be called assign a task to multiple persons or multiple participants. We're assigning a task to one printer. So this is what I need to know at this point: am I going to involve multiple people in this particular task or just one? Because if I want multiples, I'm going to choose task process instead. But we're going to assign a task to one person. So it says, let's assign a task to this user, and immediately there are two variables that have been created, local variables. One is the Task ID, so that SharePoint can keep track of this task, while it's waiting for it to be completed. And then the second is an outcome that will say that the task actually was approved or not. And both of those were created here as local variables, Outcome, TaskID. All good. So I'm going to click the this user link, and that will open up a Select Task Participant form. Now, I could enter an email address, but I'm going to click our build button to open the Select User dialog. And if I wanted to give this task back to the person who created it, I could do that right here. I could go grab anybody that I have in the workflow. I could look someone up. In this case, we're using me. So I'm simply going to choose myself and add myself right here. And the reason we're doing that is this is all about developing the workflow and testing. Ultimately, somebody else is going to be the participant here, the printer, who we're going to be given their information by the HR department. Then I need to provide a title for a task. I could say print business cards, but this printer's going to get a bunch of these. So, this is like creating a subject for an email. I want to make sure that I'm creating something that's useful, so let's click the build button and let's say, Print Order. And, let's have the number first, our quantity. So in the Current Item, we have a Quantity field. Right there. That many business cards for Full Name. There we go. That's the task. There's a print order and we have that many business cards to be printed. We can create a description. This will actually be used in the task as part of the description. So I could say use the business card template and provides more information about that. Whatever I want to put in terms of a description. And I'm going to leave that text here, so you can see where that's going to show up. If I wish, I could create a lot of text here. And I can use lookups in exactly the same way that I can build them into my task title or the body of an email. So I can just enter my body here or open in editor and do a little bit more work. Due Date, well, I have one of those as well. As you'll recall, we're calculating it and storing it in a local variable. And that is our ship to date. Now, at this point I'm really regretting that we called this ship date, and at some point it would be great to clean this up. I'm not going to do that right now, but if I change the name of that local variable, I'll need to change every place that I use it. This is a cautionary tale. Sometimes we choose a name, the user say oh, it'll be the ship date. Well it would be, but it's really not. Because now we're talking about actually having a printer say, I completed this at this point. And, perhaps somebody who ships it's saying, I shipped it on this date. So we want to be clear in our naming. And even though the folks in the business were referring to it as a ship date. We should've chosen something like date promised, estimated completion date, something like that. But right now, that's what we have so we're going to continue using it. By default, we're going to wait until this is completed. There's an email that is created automatically. We don't need to create it. We can edit it if we wish and we can add more information to it. So, I'm going to open the email editor so you can see the email it's automatically being created when we assign a new task. It says, You have a new task. It's going to show the title, we just created that. It's going to indicate, who it was assigned to. In this case that will be me. When it was due. We just filled that in. The description. We saw some text that we placed up there earlier. That says what template we should be using. And then the related item is going to provide a hyperlink, so that we can take a look at the entire task if we wish. I can make any changes I want in this email. Notice the Subject: Task Assigned. And the task title will be there, so the task title is going to be Print Order 500 business cards for. I can also create another email that is sent when this task is overdue. There is not one created by default, but I could say automatically when this task passes it's due date then we need to do something about that and send another email and perhaps send an email everyday. That says, you still haven't done this task, so this is actually a great gateway to harassment, we can send a daily email, or a weekly or monthly email, we can recur it a specific number of times, or just say Infinitely, as long as this task is overdue continue to bother this person, but that's not on by default. And then the Outcome Options are that this task is a workflow task. We don't have more than one option here. That the outcome is going to be stored in the outcome field, that was actually set up this local variable will be mapped to this Task Outcome field. And that there's a default outcome is that it's Approved. And approved and rejected, this actually doesn't make a whole lot of sense in our context, that the outcome would be used if the task is not completed properly by the user. Don't worry about that, these settings are what you want them to be right now. So, so here's our new task assignment. I'm going to click OK. We're going to check our workflow for errors Looks good. And republish this. So that's the process of setting up the task assignment. As soon as this is published, we're going to create a new item so that you can see how this works. So, I'm going to go to my business card orders and preview them in the browser. And create a new item. We're going to order 1,500 business cards for Abbey Adams and Abbey is a Trainer in the Human Resources area. That's optional. And I'm not going to enter any values there because we're just testing. And Abbey is in the Seattle office. Now I'd like to return to this form later on and get rid of this shipping forecast and the reason is, this is actually the result of a calculated field and I don't want it to show up on this form. I'd like it to show up later, when a user is looking at the information that's been entered because that value, that shipping forecast value is provided as part of our workflow. So I'll just make a note in my log that I need to do that. Create a task for it. But let's save this and here it appears as an item in our list. I'm going to refresh this. Here comes my HR order. So, now I'm receiving this in my role as the person who set up this order. Your order for 1500 business cards for Abby Adams has been received. Next, I'm receiving a task, and this task is being sent to me in my role as the printer. You have a print order, 1,500 business cards has been assigned to you. So I can view this print order, but notice that I see use the business card template. So all of this information is being provided based on the settings that we used in assign a task. Says the content of this item will be sent as an email message to the person or group assigned to the item. To the single participant. Okay, that works. I can close that and go to Outlook. And actually that came in at almost the exactly same time as the task. It's here already. I just didn't get to see a particular desktop alert for it. So here is my, you have a new task, email. A print order of 1,500 business cards for Abby Adams. So this is the email that we saw, that we could modify. As opposed to the task assignment that was sent to us automatically by SharePoint that we saw a moment ago. So, that's how this works. Now, when we're actually working on the task, there's our print order. All right, there's my task name, it's not complete and at this point, after I go do the printing, or my printer goes and completes all the printing, they can go back and mark this as being a 100% done. This is one way that we could have them do it. There are other methods. There's that approved or rejected and this is simply part of the form, that we get for a workflow action. I'm just going to save this as the participant. So returning to our Workflow in SharePoint Designer. We could still pause here, but we don't necessarily need to pause after we've assigned this task to the printer. We could remove this if we wished. And after this task has been completed, then, we will automatically go to the next stage, which is called Printing cards. So, rather than have Order received here, we might want to insert a new stage that says printing, or we might want to move this entire section here down to printing cards. And we are no longer pausing, so we are going to send, send confirmation email, and assign task. There we go. So now our first stage is order received. Our second stage is printing cards. We're sending a confirmation email, and we're assigning tasks. And then the next stage would be, card shipped, and in exactly the same way that we assigned the task to print, we might also assign a shipping task. Or shipping might be part of printing. But this is how we assign a task to an individual item. And how we modify other items and actions in our workflow to make sure that we're not overbuilding this, that we're simply allowing the workflow to drop through, assign the task and when the task is completed, go on to the next step or stage.

Assign a Task to Multiple Users

In the same way that we can assign a task like print the business cards to one person, we can assign a task to multiple people. This is a new action for SharePoint 2013 and it is called start a task process. It's very similar to assigning a task to a user. So, if you are looking to start a task process and you haven't yet assigned a task, you'll want to review how to do that. And, it says start a task process with these users, and the task outcome goes to a local variable that was created. And if we want to change the name of this from, for example, now outcome. We have outcome and outcome2. We could right now say that we'd like to have a better variable for this, and so this is a, a multiple user task outcome, for example. But I'm happy to use outcome2 for right now. Let's go take a look at the form. Select Task Process Participants. So, these are multiple participants that we're going to create. I can choose them from groups. I could say, well, we're going to give this to Ginny to work on, but we're also going to to give it to Jarrel to work on. Or, I might have a set of people that I want to assign this to who have a particular role, all the people who have the ability to review something, all of the members of a group, all of the owners of a site. So, I can choose any of my built-in SharePoint groups, or I can choose different groups within my site, all users, any particular groups that I have. Once I've chosen my users then, I have to state whether I want to do this in serial or in parallel. And you should be familiar with this because this is like our parallel block. Do I want to have people process this first, second and third in the order in which they are listed, or all at one time. I assign a task title and a description and a due date. And then, the other thing that's different is our task options. So if I choose a group, one of the choices is to assign a task to every single member in that group. That's the default. So if one if the participants that I invited was a group that was called Article Reviewers, all of them would be given this task individually. The second check box we're used to, wait for task completion. And then this is cool. How do we know we're completed? The default is to wait for all responses. If we assign this to Ginny and to Jarrel and to Mark, we wait for Ginny and Jarrel and Mark to all respond. But that isn't necessarily what we need to have done. It's possible that we just need one of those three people to respond. So think of this as a process where someone at a VP level has to sign off on an expense and it doesn't matter who does it first. So as soon as somebody's responded, we're all set and we can move on. Another possibility is that we're waiting for a specific response. It's not good enough that somebody responded to the request for the expense. We actually are waiting for somebody to say, okay I'll agree that this item can come out of my budget. So we're waiting for specific kind of a response that says a yes from one person or 100% complete from one person. And then the final option is that we're waiting for a percentage of a response. It's good enough once we've had two of the three people complete their work. If two of the three people have reviewed the article, we're fine. If five of the seven people have voted in favor, we're good to go on. So, these are interesting types of completion criteria that allow us not just to say well the work was done, somebody did it, let's go on, but also allow us to use this kind of a task process for things like governance processes where we need to have a particular number of people complete a review but we don't have to have everybody look at the review. A particular number of people agree to have something placed in a budget, but not everyone. Our email options are the same as the email options that we saw earlier. The email looks essentially the same and that's a good reason to edit it, because this says you have a new task. I might want to actually say, you are one of a group of people who have been assigned this new task. Otherwise, it looks like I'm the only person receiving it. And then finally, our outcome options, and we have just the default outcome, the outcome field, and so-on. So this is how we assign a task to multiple people by using the start a task process option, one of our new task actions in SharePoint 2013.

Adding DateTime columns to the workflow

The business card ordering system has been a huge hit, not just in the HR area, where it's taken a load off the business, but also with our users, because it does exactly what it should do. And now, with some lived experienced with the workflow, the business has returned and wants to tweak the process a little bit. So right now, what's happening is, the user's getting an email as soon as they place the order that confirms that we've received it, and we're working on it and it should be shipped in seven days. They don't hear another thing until the order shows up on their doorstep, so predictably, they are giving us some phone calls after five days or four days. Hey, are those cards still going to be on time? Are you still going to be able to ship them in a week? That sort of thing. So, we need a little bit more feedback. And, we also have some questions about how long things actually take. So we'd like to know that the cards are actually shipped, so that we could measure the time between when a order was placed and when the cards go out the door. And we want to be able to use multiple shippers, which is something we discussed earlier. So I've added three columns to our list, and I want to show you those columns. Here we are in the business card orders list. And I've included a DateTimeOrderShipped column. And, when the item is shipped, we're going to ask someone to fill out the date and time they did that, and to choose the shipper from a drop-down list that I created. Then we have this third column that's a little bit tricky, and this is because of how we're going to use a variable to wait and see if the cards have been shipped. So we want to wait for a change in an item, here in our SharePoint list. And remember, that we can't wait for this item to be bigger than or less than, we can't wait for it to be some random value. We have to look for a specific value. And because of that, we can't simply use the DateTime. It would be nice if when our shipper went in and typed, I used the United States Postal Service, and I shipped this at 4:00 PM on Friday, December 13th, that we could actually go look for the change in this field. But we can't in this version of SharePoint. Not in a 2013 workflow. So what I've done is create CardShipped and it's calculated based on a change here. I want to show you this field because this is one of the trickier things that you'll need to be able to do. We have a function, and this is very similar to a function that we would create in Microsoft Excel. You can download an entire function reference for SharePoint so that you know which of the Excel types of functions you can use. But, what I'm doing is I'm using the DateTimeOrderShipped. Now, it's empty by default. There's nothing in here at all in DateTimeOrderShipped. So if it's blank, then the order has not shipped. If it is not blank than the order has shipped, so it's a reverse piece of logic. But as soon as DateTimeOrderShipped is not blank, then this calculation will say it's not true, that it is blank, therefore the order has shipped. And let me just show you that in the actual list, so that it makes some sense. If we go to business card orders and notice cards shipped. This is automatically calculated. So for example, if we edit in this list, we're going to go back and look at some historical items here. And let say that this item was shipped on the 16th, at 11:00 in the morning. We'll say OK, and notice that as soon as this is saved that CardShips recalculates to yes. Yes, they've been shipped. So, that's that equals not is blank, logic, that's working for us here, so that we know in fact it's been shipped. And, we can wait for a change in the CardShipped to yes. So, our CardShipped column provides information to move our workflow along. The DateTimeOrderShipped provides specific information that we can use, then, to determine how long it took, for this order, from the time it was placed until the time it was shipped. We could insert at other points, DateTimeOrderPrinted, DateTimeConfirmationSent. Anytime we'd like to be able to know exactly when something happened. We can simply have an interaction with the user. Either in a form, in InfoPath, or in a column and say, tell us something very specific here. Now that we have a specific OrderShipped time and date, and we've always had a specific time that this item was created, we can calculate the interval so that we can capture the performance information.

Finding an interval between two times or dates

We've prepared our list by adding a date time field to indicate when an order was shipped, so now were ready to calculate the interval between the time the order was placed by the user, and the point at which the order was shipped. So, the last physical item that was completed, was the printing, so let's imagine ourselves in the setting where we have some cards that have been printed. They're, sitting packaged up, maybe with shrink wrap on them and a label, some other information, and somebody now is ready to print them. And we don't have to pause until this variable, because we're done printing our cards, and we're replacing these pause actions, which were proxies, with actual actions. So, what we need to know is. Has a user actually indicated that the item has been shipped? It would be nice if would email someone to tell them that they are now ready to ship this item. That would be great. So, at the end of this stage, after we've assigned the task and we know that the printing is done, because this task is actually completed. We could add another step. And this step could be send email cards ready for shipping. We need to ask who this goes to and we take care of making sure that that email gets done, and one of the pieces that we're going to do within that email will insert a comment here. It is when we create that email. Email instructs recipient to enter the date, time of shipping, and shipper used. So, that's great. We've got that in there. If we want to put that in a task and assign it, we know how to do that, as well. So now we know that we have asked somebody to ship these cards. We've sent than an email and we're waiting to see if they have done it. So, we're going to go next to the card's shipped stage. We will know the cards are shipped because there's been a change in one of our fields. So we're going to wait. For a field change in the current item. So the field that we're looking for is that yes no field CardShipped because we want to look for something specific. So we're looking for CardShipped to equal yes. As soon as CardShipped equals yes, we know that this order has indeed shipped. Now, if we want to change the name of this stage to CardShipped we could. And we could say shipping cards, if we wished. If we change that it will automatically change here where we refer to it, so it's not a bad thing to do. So now we have card shipped, and we can calculate an interval. Because if we did it any time before this, we don't know that someone has actually entered the date and time that they shipped the order on. So all of this was to get to the point where we can go and use the utility action for subtracting one date from another to find the interval. By default, it's calculating minutes. So, how many minutes is it between the time the order was placed and we actually shipped it? That's going to be a really large number. That feels too granular. Days, on the other hand, doesn't feel granular enough. I might want to know. If it was eight o'clock in the morning the day after 4 p.m. So, let's use hours. It'll give us some big numbers but not insurmountable. In the first date is actually in current item. We know exactly what stored because it's created. This is the date time when this order was created. And the other date I want, is also in the current item and it was just entered by our user and we know that because CardShipped was set to yes and that's a calculated field based on date time order shipped. So these both must be of the type date time. Because that's what Interval works on. So, we're going to say, find the hours between current item created and current item shipped. And we're going to output that to a particular variable. Now, of course, I'm not in love with that name, I don't like Time, Cal etcetera. I actually want a name that makes some sense to me. So, we're going to say total hours for order, that would work. And notice that this is reporting out as a number. It's a number of hours. Every time I use interval, it's going to report out as a number. It's not going to say, so many hours and so many minutes. I'm choosing between hours, minutes and days, and it's reporting out a number. So this is how we calculate an interval. We have to have two time date fields that we can subtract from each other and we can report that out in minutes. We can report it out in hours and we can report it out on days. Right now all we've done is stuffed it in this local variable that was created for us by a SharePoint designer. We created a new one to replace it. If I want this variable to stick around I'm going to need to do something with it. So, after I'm done calculating the interval, I might want to write this particular interval someplace. I could send it in an email that would report it. That doesn't feel all that wonderful to me because if I want to be able to do an analysis of how long orders are taking that forces me to turn around and type all of this into an excel worksheet. So the very best thing that I could do would be to store this back in our list. So, I could add another field to the list that would say for example, total hours for order and we can, we can set that value of that item to be equal to the value of this local variable. I could also create another list and write this some place else because I can set that value almost any place I want, if I want to track a whole lot of different work flows and how long actions take. I might want to set up a place just to calculate and keep track of that kind of information. So one choice then is to add a column to our list that we have right now, and then write this variable information to that column. We'll look at this and other options in some other movies. But now, we know how to do the critical piece, which is to be able to set up and calculate an interval between two different dates or times.

Updating List Items

We have information in the TotalHoursForOrder variable. A local variable. That will of course be thrown away, discarded, when this workflow ends. As will every other value stored in a local variable here. I want to do something with it, and what I prefer to do is to store it someplace that I can use it later for analysis. I've decided that what I would like to do is store this in a column in my list. So I added an HoursOrderToShip column of the type number. So, what I'm saying is I want to be able to track how many hours it was from the time it was it ordered, to the time it was shipped. And, we're going to report that back as a number. Let's go back to SharePoint work flow. Now, if I had just jumped over and inserted that new column, it may not show up here in my workflow. So one way that I can make sure that I have the most recent information from my SharePoint server reflected here in SharePoint Designer is to do a refresh. And when I do this, it will go through the entire site, and make sure that I have the most recent information about lists, about workflows, content types. Every single thing. So if you ever are trying to choose a field or choose an item and you don't see it, don't forget to refresh your site. I've actually done that already, it takes about a minute and a half, so I did it while we were between sessions here. And what we're going to do now is we are going to update an item. This is a list action. Update list item, and we're using the easiest form of this. Which is go into the current item, right here, and set the value of a field, in this case, HoursOrderToShip, to a particular value. Now, I can type a value in here. I could type in 12 or one or something else, but that's not the point of why I'm using this. I'm using this to be able to go into my workflow of local variables, to find the total hours for the order and to be able to store it. Now when the workflow ends, I don't care that this variable gets destroyed because I've captured the value. If I wanted to update other items at the same time - maybe I have seven local variables - I've been calculating them all the way through this workflow and at the very end, now I'm ready to write them all. So what I can do is create a different column for each and every one of those, and I can add them all. I don't need to come in and call update an item and do them singularly. I can add them and do them all at one time. So I'm going to say OK. So we're updating an item in the current item. That's great. I said that we were using the easiest form of this. I can update an item anywhere. I need to be able to find it. So right now the current item is the current record in our business card list. But if I wanted to update something somewhere else, I have to go find it. I have to essentially do a look-up and say, well I'd like to update an announcement but I'm looking for an announcement that was created on, at a particular date in time. Or I want to update the third record in a particular list. Or I want to go find the most recent document in a document library. So, when we use that update in that way, after you choose a list, you're going to see a different dialog box. So, I'm going to update, for example, my departments list. And notice the addition. It says, how will you know which record you want to update? So I can say, well, I know that I want to update my departments list because I want to update the department where the value is. And I can build a particular value or enter a particular value or I can say it's the department that's in the current item. So, now having found the department that's referenced in this current item, I can say set the value, for example, of the Director's email to this new value that somebody typed in. So, we can imagine that a user will be able to enter information. They'll say, here's this department, and we have a new email address, and we can use this update method to go find a department, and to update the value of the email address. So this is the more verbose or complex form of Update List Item, which requires us first to be able to identify the particular row or record we wish to work with. As always when we're looking for a particular list item, if the criteria we provide relies on a field that does not require unique values, then it's possible that, for example, this department appears in the list 12 times. And our choice will be, is it okay if we just use the first one? And we either have to say yes, or we need to start making sure that we have a unique ID in every single one of our lists that we want to use in this way. Which is a good thing to do from a design perspective. So, the two flavors of Update List Item: Update the Current List, very easy. Update Any Other List, first we have to find the item that we want to update. The particular item, and then identify the field and the new value for it. Update List Item is one of the most powerful workflow actions, because we can update any list from anywhere, as long as we can identify what item it is we wish to update.

Extracting Substrings

You could create dozens or even hundreds of SharePoint workflows and never have the need to extract sub strings from strings. But if you require this functionality, you're going to want to know that it exists and how to use it, because it will save you lots of time and effort. This is a library that you haven't seen before. In this particular policy library we have policies that have a particular pattern to their file names. Every time we save a policy in this library it begins with two characters, a dash, two more text characters, a dash, a policy number and then another dash and it's following then the name. Many times when we have this type of a practice where we code things in a particular way, it's because we didn't have another place to put the meta data. Or because this type of a practice dates back from the days that you could only use eight characters in a file name. The question is, if we decide now that we would rather not have to do the archaeology in a file name in order to sort and filter and find all of our finance policies, or all of our policies about compensation or benefits, how do we do that? Because this isn't useful when what we want to do is find all of the policies for the HR department, but not the policies for the finance department. So let me show you what that coding is again. The first two characters are two characters for the name of the department. FI for finance. HR for HR. IT for technology and so on. BEN is the name of the type of policy. This is a benefits policy. The number then, is everything between FI BEN and the actual name of the policy which is preceded by one dash. So the pattern is two dash three dash three dash two, which together are the policy number followed by a name. So let's find out how we're going to extract these three fields here from this file name that was provided to us. In SharePoint Designer, I'm going to open this library, which is a policy library, take a look at our list columns. Everything's here. If it wasn't, it would be a good time to refresh this. And let's create a workflow. Now, before I do that, let me just state that in the future, when we have users saving documents in this library, we'll actually have them fill in the meta data in these three new columns. So what we need to do is deal with the back log of policies that we have that have been coded using the standards that we used previously. So what we want to do here is extract metadata from file name. And we might want to give it a little more of a description here. This is a user initiated workflow to extract the department code, policy type, and policy number from the file name. Got it. Let's say OK. So we want to extract metadata, and we need some local variables to store it in. So the first local variable we need is the department code, and it's got those two digits, so I'm just going to put two here so I keep track of it, and it's a string. Then I need to policy type code and it's three digits. And finally I need a policy number, and it's not a code and it's also string even through it have numbers in it because it has a dash in the middle of it. And it is a total of six characters long. And we're going to say OK. So department code two, policy type code three, policy number six and the two, three, and six are there for two purposes, one is to remind me how long they are. But the other thing is then, if I have policy type code that I'm using as the name in my library or department code is the name, I'm not going to confuse this at all because these will all have numbers at the end of them. Now that I have my three local variables, we're going to go all the way to the bottom of the list to utility actions. And the first thing we're going to do, is we're going to extract a substring from the start of a string. There are four of these that we can use. One is to go to the end of the string. Another is to do an index of the string, in other words, some particular position in the string. The third is from the start of the string. And then, the fourth is indexed with a particular length in the string. Let's start with the start of the string. Copy x number of characters from the start of the string to a variable. Well, as you'll recall, we start with two characters, but I don't have to recall. I can say this is actually first my department code, and it's got two characters. So copy two characters from the start of the string. Perfect. Next, were going to extract a sub-string from index with a length. So were going to copy from the string and we have three characters that represent the department code. And the dash that follows. So we don't use one, two, three. We'll go to position number four. Starting at the fourth position for three characters. And we're going to place this item in the Policy Type Code. Now, each time we're saying string, we do need to tell it where it can find that string. And it's going to find it in the Current Item, and it's the name. So we have our department code and our type code and we need one more. And it will also be an index. So extract sub-string of string from index with length. We're going to copy from the name. So, department department dash, that's one, two, three. Four, five, and six are occupied with our policy type code. Seven is the dash that follows. So beginning at position number eight, for six characters. And we're going to send this to our policy number. This is how we extract these items. Easy enough to do. Now the next thing we're going to do is take a look at how we can log these items. So, stay right where you are or if you wish, you could save this, but first we'll have to have a stage that ends the workflow, so let's say our final condition here is to go to a stage and we'll end the workflow. Just so we're ready to save this and that way you can save it. And, I will see you in the next movie, when we find out, how we can write these somewhere, without necessarily putting them in a column. A nifty little trick.

Strategies and Techniques for Easy-to-Maintain Workflows

Using the Workflow History

This workflow extracts data from a file name, and to this point it is taking the meta data and storing it in local variables that we created, I'd like to be able to make sure that this works, right now, very easily, without needing to take these values and put them somewhere else, so how can I see the value in a local variable? The answer is that there's a history that's being kept that we haven't yet taken advantage of. And being able to write local variables and other items to the history is a way that you can test items, that you can troubleshoot your workflows. And it's also a way that you can just make sure that you kept a record of local variables as you've used them, whether or not you write them any place else. Let's go back to the workflow, and you'll remember that the history list is called workflow history, and that this is being kept for a number of different workflows. If you go a look at your site content you will not find the workflow history there because it's actually hidden. It is stored in a list that is not visible but is accessible to you. So if I wanted to get to that list I would go to my URL from my site So, https://, your site name, and the exact subsite. So I would be in the HR site. When you have your site and the appropriate subsite. Then you have a slash, the word, lists, a slash, and workflow, space, history. Press enter, and it will pop your workflow history open. So I'm going to just show you what our workflow history looks like right now. So there's my site, there's my HR site, lists slash workflow history, and there it is, so this is visible to you, we're not writing to it yet, but as soon as you begin to start writing to it, you'd like to know what's happening here, so this is how you can get to the workflow history. For all the things that you've created. All of the different logs that you have kept here in this history. Here's our particular list though and, if I create a workflow history entry for one of these items, it will be accessible from the item and from that item's workflow. So, let's see how we can write to our workflow history. Back in our extract meta data from file name work flow. After we have these three items extracted, this is what I'd like to write a note about in our history. I'm going to go to action and in my core actions, log to history list. And I get to log a message to the workflow history list. I just showed you where that list was kept. So let's use a builder and I'm going to say the following values were extracted. I'm going to be a little more robose here then I necessarily would. And so the first is that we have a department code two and let's just insert its value for my workflow variables and then I have a policy type code three. Again, I'm going to my Workflow Variables. And Policy Number, six. Workflow Variables. Okay. So there's my string. The following values were extracted and I'm going to write those to the workflow history list. Notice, I'm not prompted what workflow history list I want to use. That's set at the level of the workflow. So, it's the workflow history attached to this particular workflow. And then, finally, our transition is to go to the end of the workflow. I'm going to check this for errors And save and publish it. And then we're going to see how this works. So remember you can log at any point you wish and it's always going to one place. It's going to the work flow history and it attached to the particular item it is that you're working with. So this is incredibly handy. Let's go back to our SharePoint site and we're going to stop editing this list so that I can run a workflow. Here we are workflow so that I'm looking at FI BIN 10001. Gap benefit accounting and I'm going to choose workflows to open the workflows page and I can extract metadata from filename. Great, I just ran the workflow. So, how would I know? Well first, extract metadata has run. So after I ran this, says it did this, and I'm going to click where it says extract metadata. And if I look, here's my history. The work flow recorded these events. The following values were extracted. Department code two, F-I. Department type code is E-N dash and policy numbers zero zero dash so this isn't quite right because i'm off. This should be FI-BEN-100. So i'm off by one. Great. I know now that I need to fix my workflow before I do anything else. So let's go back to those extracts and fix it. So when I'm copying my first two characters that works, but then it looks like I need to start a character number three. For three characters, and character number seven for my six characters. Great. Now, let's save this. We could check it for errors first. No errors. Publish, which will save and publish. So now, I have a new version of my workflow. That's going to be become important in a little bit. That first workflow is still present. I have one item that ran using it. So, one of the things that we'll want to do when we're modifying workflows like this, is get rid of the earlier versions of the workflows. That have completed so they're not kicking around and taking up space. Let's go back and run our Work Flow again. So, let's go to our policy library. I didn't make any change to this. So, I could actually run this same Work Flow on this item again. But, let me choose a different item. Just so we're seeing this work on more than one. And I can click. Remember this is a manual workflow. So I'm going to choose Workflows. Takes me to the workflows page. There's only one here, I can start this new workflow. It's done. If I refresh this, you'll notice that it says Extract metadata. I can click this link to see what meta data was extracted. The following values were extracted, DeptCode2: FI, PolicyTypeCode 3: COM, PolicyNumber6: 200-15. That's exactly what I want to have happen. My workflow works just fine. So, being able to log allows me to test without having to send e-mails, without having to take all of these items, and put them into department code, policy type, and policy number columns. It's not that much extra effort, but notice that, I would have had to change them all, just to make them work right. Because I hadn't quite done the extract correctly. When I was extracting, starting at the beginning of the string. I forgot that I needed to leave one off. So, It's easier for me just to go in and to log this, and take a look and say, that's what's happening. Now, in terms of making your workflows easy for you to maintain in the future, it is just a good practice that whenever you're creating a local variable, and you're adding a value to it, go ahead and write that to the log right then. You can write to your workflow history multiple times during a workflow. And this is a way that, that when you want to see how the workflow's working, you can go in to the workflow history, you can just run your workflow, go in and look at the history and say here are the series of things that happen, here are the comments that I place by choice because I have the ability to use the history as my tool as a developer. To keep track of what I've done.

Using Email Aliases for Easy Workflow Maintenance

This is an employee on boarding workflow that we worked on much earlier in this course, and I'm bringing it back so that we can have a conversation about how to effectively use email aliasing in your workflows. In this workflow it begins when a staff person in the HR department creates a new record in a list and says, here's this new employee, and then we have a series of emails that are sent to different departments so that they can begin to do the work that's listed here. The technology department's adding employees to active directory. The finance department's adding them to the payroll system. The operations group is giving them security cards and a phone and an office. And then finally we're letting the director of HR know that all of these things have been done. And so we were sending an email to myself and tech, to Mark in finance, to Juan Estez in operations, and to Karyl Tyson in HR. And then, Juan, went on sabbatical. We knew this was going to happen but we were busy doing other things like creating workflows. So our CEO stepped in and said, for right now, while you're working on this workflow, send the emails to me. And it's in this moment in this instance, that we can make a decision that is going to benefit us and reap rewards for the entire time we're working on this workflow. Rather than simply using G Courter at our organization, or J Estes, or using Jaryl Richardsons which is just Jaryl, she's a CEO so she gets her first name, we can create an alias. So let's take a look at some possible aliases and why we would use them and what they would mean. When you create an alias, what you're doing is talking to the exchange administrator in your organization, assuming it's not you, and saying I need an email account that has a specific name that I can call out into workflow, and then we're going to send the email that comes into that account to a specific person, or possibly a group of people. And your exchange administrator will know exactly how to do this. So in our workflow to begin with, we had gcourter@insightnoi on microsoft.com, mlacie@jestes, ktyson, those are personal email addresses, and if we use the personal each time we change people within our workflow you and I are going to be in editing our workflow. So it's better to use a departmental alias. So if, when we want it to send something about this workflow to the tech department, rather than sending it to G Courter, we could address it to technology. And we would ask our exchange administrator to set up an email that was technology@, finance@, operations@, our company's domain, hr@. But the odds are good those exist already and are already being used that when somebody wants to send a question to the technology department, they're sending it to technology@, and that's being handled by someone. So the third column represents aliases that are more typically used inside of workflows, that are specific to a workflow role. Let's look at the second instance, Mark Lacie. His workflow role could be that he is the finance person for workflow right now. So if we have our exchange administrators set up, wfFinance or workflow finance, then every single time we're sending information to the finance department about a workflow we will just address it to wfFinance@ and our company's domain. The exchange administrator right now will have that aliased to go to Mark Lacie's inbox, or aliased to go to another inbox that Mark Lacie has access to open, depends on how you specifically want to do that. Another possibility is that Mark is just our finance person for this workflow that in the finance department he does onboarding, but there are other people who do other workflow tasks. So it's not appropriate to have a generic finance workflow role. We actually have a finance role in the onboarding workflow. And so an alias for that might be financeOnboardingworkflow@ and wf stands for workflow, or you could do wffinanceOnboarding, or wfOnboarding finance. Figure out a system and stick to it. None of those are right or wrong. So if every time you were using a work flow roll you started with WF, and then you had the name of the workflow, in this case On Boarding, and then the more specific role, the finance person, that would be great. Now let's look at Karyl Tyson, because there are different considerations here. For Karyl, she's the director of HR. She's actually the business owner of this workflow. You and I created it, but we created it at her request and if it's going to be changed it will be because she asks to have it changed. So one possibility is wfHR, but I will tell you that there will be lots and lots of HR workflows in most organizations. So more typically, we might want to have HROnboarding, or WFOnboardingHR, something that says the HR person in the OnBoarding workflow. But there is another role for Karyl here, and that is as the owner, and so you see WFO or workflow owner Onboarding. So in this instance, we're going to be emailing the person who owns, is in charge of the workflow, the person who ultimately at the end gets the information that says, hey, this workflow has been done because we send them an email, the person who can drive changes. So, WFO or workflow owner is a role that I use in my aliasing, and you'll notice at the top, wfaOnbaoarding, that's workflow administrator, the person who's in charge of making sure that the workflow is running and who will actually be the person who will make changes if we want to have them made. There are other roles that we see in some organizations WFD for Workflow Developer, WFQA for Workflow Quality Assurance, and so on, WFTest for Workflow Tester. So, this is how we work with aliases. Notice then, that in the case of Juan Estes, if we use a workflow role, which as OperationsOnboardingwf then at the point where Juan isn't going to be the person in that role right now, it's going to to be Jaryl. We don't need to edit anything in our workflow, because when we sent an e-mail we didn't send it to Juan Estes. We didn't even send it to operations. We sent it to OperationsOnboardingwf@our domain. To make the change to Jaryl from Juan, all we need to do is ask our exchange administrator to change Jaryl to Juan. Now, from our exchange administrator's point of view, they would almost rather we use personal because it results in less work for them. When we look at the workflow roles, they would far rather we were sending something to wfOperations that's going to Juan than to have a specific different alias for every single workflow that Juan's involved in. So, part of this becomes political and it's also about respecting the folks you work with, so that you're not asking them to do additional work on a trivial basis for, you know, new work for no good reason. If you're only going to run five or six workflows that include Juan then use wfOperations@, or use wfOperations@ for almost all of them unless there's a specifically different role, then in this case it wouldn't go to Juan, it would go to someone else, and in that case you might name that workflow role OperationsOnboardingwf. In other words if you have a hundred workflows I'm not going to encourage you to have a hundred different aliases, or 200, or 300, because in each workflow your'e recognizing the owner, you're recognizing the administrator. Your task is to find the middle ground between overbuilding and underbuilding to find that efficient place where you're not asking your exchange administrator to do too much work, and you're not having to go edit workflows too frequently. So, use this as a guide. Above all, do not commit to using personal emails over and over again in workflows. Use them early on when you're doing testing. You've seen me use my own email several times so I could make sure that something works. And then, insist that Mark Lacie figure out what he would like to be able to do with workflows so they aren't always being sent to his inbox. Tell him, we're going to set up something called WF Finance, and we're going to send that to you right now. As a matter of fact, you don't even need to tell workflow participants that you're doing this. You can just build it this way every single time. If you build using roles and aliases when the winds of change blow you will be able to quickly and easily work with your exchange administrator to be able to change all of the workflows very rapidly and not have to spend development time and development dollars solving a problem that is predictable from the very beginning.

Prevent Workflow Errors

There are two related terms I'd like to introduce, that have to do with how we design workflows. One is error trapping, and the other is error prevention. Error trapping is a strategy that you employ, to make sure that if you have an error in something you create that would, stop the process from running. That would result in the user getting a warning that says this just isn't working. That rather than letting that error actually occur, we anticipate that it might happen and we create a way to grab it. To stop it and to handle it, so that the user doesn't have the application they are working with or the work flow they are working on blow up. So, error trapping means, if there's going to be an error. Rather than letting Windows or SharePoint or Visual Basic handle it, we're going to handle it ourselves in a more elegant way. So, we don't do a lot of error trapping per se in SharePoint, unless we're using Visual Studio. SharePoint Designer doesn't provide for error trapping. But it does provide for error prevention. Error prevention means that we're going to build our workflows, so that it's less likely that an error will arise. Sharepoint is very resilient. If your workflow runs, it's going to continue running unless someone changes it. And, most of the time, our users are going to enter values that make sense in the business. So, once your workflow is running, we're not going to worry that all of a sudden it will, it will stop for no apparent reason. But we do have to be concerned that something will change, and that, that change will in a negative way impact the work flow. And so this example is about how we have an error that happens, that could even cost our business money. We can anticipate that this error could occur, and we can therefore make sure that we prevent it from happening. Here's the heart of the issue. We have a work flow that's running already and it's processing transactions. So, what happens is when we add a new item, a Visa, Mastercard, or an American Express item, then the work flow runs. And the result of this is that right now we're writing to a history log. It says $45 processed using the Visa gateway, for example. So that's what's happening. Let me show you our workflow. Here in SharePoint Designer is the workflow that we created earlier, but with some logging added on. And again, this is a technique that we're using because we're developing a workflow and we'd like to be able to write to the workflow history so we can make sure that it's working properly. Here's our American Express. Here's our MasterCard, here's our Visa. As soon as one of them, is the correct match, as soon as the credit card type equals American Express, this is executed, nothing else is. We fall through to the bottom of that stage, and it says go to transaction processed. Transaction process says go to end of workflow. So, that's what happens within this workflow. What could possibly go wrong, and what do we need to prevent? Well, there's conversation happening in the finance area, and in sales, and a decision has been made that we are going to start taking Discover cards. But nobody remembers that we actually need to do something about it in this work flow. They say, oh, it's easy enough for us to take Discover cards. So they went into our list, changed the list settings, modified the credit card type to include the choice for Discover cards. They told the folks in the business, we're taking Discover cards. They've got a little sign on the door next to the American Express and Visa and Mastercard logo. The Discover logo's there. We're taking Discover cards, but our workflow doesn't know it yet. So when we enter a new item. For $750.12 with a Discover card, and put in that Discover card number, and save it. And we refresh this, perhaps a couple of times. Hm, so what's it doing with that Discover card? Why isn't our workflow completing? Now we might notice that we have a transaction that hasn't been processed here. The user might even be smart about it and say, wow, I wonder why that work flow is not running, let me run that work flow. They could come in and even process it manually. There we go, now it's finally processing the transaction. And it's all processed. And if I take a look at it, what I can see here is that there’s no history. Nothing was logged. But I wouldn’t necessarily see that just looking. I go look at it. All these credit card processes got all done. All of our transactions. We've got money flowing into the business. So this is the problem, the problem is in this particular case we're using if, then, else or we're using a set of conditions and we're not making sure that we're taking care of every possible condition. How could we have prevented this to begin with? The way that we need to think about error prevention is, is it ever reasonable that somebody might change this list, that somebody. Would be allowed to enter a value that wasn't already here. And in that case we need to enter one more else. And if we did that we would never have a problem here. So, we would say we need a new else branch. So if it's an American Express, do this. If it's a MasterCard, do this. If it's a Visa. Now notice in each case, we're saying if it's American Express, if it's MasterCard. Some people would, at this point, not even do this if. They would just say, well if it's not American Express or MasterCard. It must be a Visa. They would leave out this if. That's an issue because you always want to check to make sure that we're clear, that we're not assuming what the value is. But in this particular case, what we're going to say is, hm, what would happen? Well. If it's not an American Express, a MasterCard, or a Visa, we should never get here. So the first thing that we could do, is we could actually add a log to the history list that says, error, credit card type, and then we could put that right here, in parentheses, for example, the credit card type. because what we know is it's not one of the types that we're looking for. Out of range or not an acceptable value. Sometimes what I'll do is I'll actually start this with, you should never see this message. Because you shouldn't, we think we've accounted for all of the other possibilities. Error, credit card type out of range. I can also hang on to that information if I want, could copy it and paste it some place else, because I don't want to just log this. We really have a problem here. We are taking in transactions. Where they have a credit card type, they have to, because at least right now, that's a required field. But the credit card type isn't one that we're anticipating. So the other thing I want to do is, I want to email at least one somebody and maybe more than one somebody, so I'm going to send an email. And, I could send that email to whoever the owner is of the workflow. So if this is a finance workflow, I could send it to Mark OC, I could send it to Carol if it's an HR workflow. We're building it in HR right now. And I can send it to whoever the administrator is for our workflows. So, I'm going to send this to me and I'm also going to send this to Carol. Because this is one of hers. There we go. Says the selected user may not be valid on the site. She is, so am I. And the subject is workflow error. And we can even say we know a little bit more about that, we know what the field is, so we can say workflow error. Credit card type, not in approved list for example. So there's our subject and then we can provide lots of information that says, this is exactly what happened, a credit card transaction. And if we had a, a number for these, that's when it would be really great. But this has a title. It has a unique ID that identifies at any place, within SharePoint. It's called a GUID or a globally unique ID. And we can go get that field, because then, with the GUID, we can find almost anything we ever need. And credit card type, credit card number and so on. But we want to notify people that we actually have an error. So this is error prevention. We've accounted for American Express, MasterCard and Visa. And now we're saying if it's anything else, you should never see this message. I'm going to publish our workflow, and of course when I do that it's also checking it for errors and saving it all at the same time. So now let's go back to our list and add a transaction. So here's a new item. And this is Bobby's order for $489.76. Using a Discover card. And we're going to save this. And if I refresh this, it's processing the transaction. If I refresh it again, the transaction is totally processed, it's all done. If I click to see our work flow, it says you should never see this message. And here is our note coming in right now. Work flow error, credit card type Discover, not in approved list. The transactions, Bobby's order, there's the GUID. So, that worked really well, that's what error prevention looks like. We created the ability to take what would be a, a problem for the business. It's, this isn't a traditional error trap because nothing stopped and said whoa, whoa. Wait, there's an error, the system can't run any more. But it's the same type of a strategy. We don't want this kind of an error occurring. We want to make sure that it can't, and therefore we are going to build some strength around our conditions, to make sure that we've accounted for the possibility of this kind of an error. Right here, the possibilities we expect and when we don't get them. The ability to communicate that we have a value entered that was out of range. That's one way that we can design better and better work flows that are easier to maintain by paying attention to error trapping and prevention.

Modifying Existing Workflows

Throughout this course, we've been, opening up workflows in SharePoint Designer, making some modifications and resaving and republishing them. SharePoint makes it really easy to modify workflows because it's not unusual to need to modify one, not just during development, but even after the workflow is already in production. For example, the needs of the business might change, we might decide that we're taking a new credit card that we weren't taking before, and that causes us to look at, and modify, our workflow. But it's also true that even if the needs don't change, your users' imagination of what's possible to do with the SharePoint workflow will grow, the more people are working with the workflows that you have created. So you begin by creating a workflow that solves the presenting business problem. And, we did that when we were working with the order business cards workflow. The original request was simply to do a couple of calculations, and to send a couple of emails. But then, over time, it became clear that it would be really nice to be able to assign a task and capture information. And grab some key performance indicator data, as well. So this is a work flow that has grown. And, if we image that it's been in production all along from the time that we first created it. And we, perhaps, had 50 business card orders in our first generation of this work flow. The iteration that simply did a calculation, sent an email, waited seven days, and then changed the state and ended. Those, 50, new items that were created during that time, the 50 business card orders, are going to continue using that work flow until it runs and is completed. And unless we provide a way to manually start a workflow from any of those items, it will never be started again, for any of them. My imagination of how SharePoint actually delivers workflows in the workflow engine is like watching somebody at the top of a hill with a kid on a sled. And, we take that child and, give them that great big push so that they're taking off down the hill. And then, we decide, oh well, for the next child we're, we're going to send them a little further to the West. We create a, a new path, a new workflow, for the second child who we're assisting. But that first kid on a sled is still careening in the direction in which we released them. You need to be aware of this, and you need to think about it as you manage your users' expectations. For example, when the business says, we want to be able to, now have, tracking information. And so, every single time someone orders, a business card, lets track that. Any business card that's already ordered and is in the queue will not have those fields. So, you'll need to have a conversation with your business owners for the work flow. And say we can do that but we will not have a way to be able to have our work flow calculate all of the orders that were placed before, because we really don't know when printing was done. And so, we won't be able, for example, at the end of this year, to make a statement about happened with all the work flows during the year. Any time we change a workflow it's from the next new item going forward, if we're signing it on a create action, or the next modified item, if it's on a modified action. So that's the first thing. Be aware, always, that when you create workflows, you get a new version of a workflow, and the old version is still running. The other thing is, there are some changes that you can make, not necessarily to the workflow, but to the workflow settings, that can be problematic, and so you'll want to know about those. I'd like to revisit the settings area and remind you that, if you've discovered as you're using this workflow that you'd like it to have an independent history, if I change this history list, it has an association to this particular workflow. So, if I say, I'm going to create a new history list, this is a way to create a problem inside our SharePoint work flow. We really would prefer not to change our task list or our history lesson once this workflow is in production. So you will want to have a practice in your organization about whether or not you have individual task and history lists for, perhaps, two or three major workflows. Perhaps for every workflow. Or, if you are using a consolidated workflow history and a consolidated tasks list, which is what most organizations do within a particular site. So, other than setting changes, you can't do much to improve a workflow that is going to create a significant problem for you or your users, as long as they understand that any change is a change that goes forward. And, of course, can't be applied retroactively. You don't have that ability, to stop that sled going down the hill and route it further to the west. You simply need to say, I'm going to create this workflow change for you, and it will apply to all new workflow instances that are created going forward.

Managing Workflows: Blocking, Removing and Reinstating

Occasionally, you may want to remove a workflow, or stop using a workflow. It's possible, for example, that you have a list, and the business, users want you to create a workflow. And you use it for a while, and they say, eh, we're going to do something really different. And we don't want to invest any more time filling out the metadata and using this particular workflow. So why don't we just shut it down for a while? While we regroup and figure out what it is we do want. That's possible. Another likely scenario is that you've created another workflow, that essentially is going to replace the one that you're using now. And it's quite different. So rather than modifying the workflow you have, you create and assign a second workflow. So now we have two of them. One of them, of course, still has some instances that are running, because we've been creating new items all the while we were creating a new workflow. So, we have the ability to block a workflow. So it can't be used anymore. To remove a workflow that's not being used or shouldn't be used. And to bring back a workflow or reinstate a workflow, that we had previously blocked. So I'm going to go to my, workflow settings. And there is one workflow here. Now I could create more than one workflow. This current workflow has no workflows in progress. Every workflow that was begun, in the credit card transactions list, has actually completed. So this is a great time to remove a workflow if we wanted to do that. We click this remove block or restore workflow to get to all three of those actions. And it shows us the two types of workflows that we could have. SharePoint 2013 workflows and SharePoint 2010 workflows. If I want, I can say I don't want any new instances of this workflow to begin. Now this does two things. Not only will it not start automatically now when there's a new item. But the user will not have a choice to manually start this workflow, it's not available anymore. If we had workflow instances that we're still running, it would allow them to complete. If I remove a workflow, it is no longer associated with this list at all. And at that point, any workflows that we're still running, get terminated. They're just done. So this is unplugging this in a major way. If I simply want to take a workflow and not use it for a while, then what I should do is choose No New Instances. The workflow will not be available to be used, but it won't be gone. I can still go in and edit it and work with it. And when I'm ready to use it again, I can simply choose Allow. And it will once again become available, in the same way it was available before. It's a good thing to go in and make sure that if we believe it's going to start automatically that it's set to do that. Or that it's allowed to start manually. So you'll want to check the settings. Make sure everything is what you would want it to be. But this is where you say no new workflows of this type. Get rid of this workflow altogether. Totally disconnect it. Or if we simply we're saying no new instances which is also called blocking. Say no, we're going to allow this again. So those are the choices to manage the workflows that are associated, with a list in SharePoint.

Workflows Beyond a Single List

Creating a Reusable Workflow

Prior to SharePoint 2010, if I had a workflow that I wanted to use on more than one list or library, I either needed to use Visual Studio to create and encapsulate it, or I needed to do some research and download a really long article from Microsoft. About how to take a workflow and attach it to a different list and change its globally unique IDs or GUIDS, and all kinds of detailed information just to get something to work in more than one place. In this version of SharePoint, if I have a workflow, that I know I might want to use in more than one place, I'm just going to create it as a reusable workflow. This is one of two types of workflows that aren't attached to a specific list when you create them. The other being a site work flow. So I am going to choose create reusable list work flow. And I need to give it a name and a description. This is a walk through the process so we are going to do something really light weight here. We're going to email the submitter. Description is send a confirmation email to the submitter slash creator of the current item. That's it. You'll notice that the base content type here is listed as all and we're just going to leave that, we'll talk more about it later. We can build this as a 2010 and that would allow us then to choose a different content type. But this is a 2013 reuasable workflow that we're creating so we're going to work with content types in a different way. I'm going to click OK. Here we are. So, in our first stage, we're just going to call that sending email, remembering that we can report this out, so that it's going to show up in the list. Those nice active verbs are always better rather than emailing or send an email. Sends seems like a direction. Sending is more of a report on whats happening right now. So that's great. And now what we need to do is send an email to these users. Will click the Select Users button to open the select users dialog. And I'm going to choose the users who created the current item. And add them. And say OK. So, if we wanted to do a build here. Notice that when I add or change a lookup, I get just a real paltry list. And, these are the base columns. Remember that I can use this with any list. Basically any list, any library. So all that's here are the items that are default items in Lists and Libraries. So I don't know that a list will have a full name or a first name or, a, a sender, or I don't know what it'll have, but it will definitely have an approval status, cause that's built in. It'll have, or could have a content type. It will have who created it and when. An encoded absolute URL. It'll have a globally unique ID, an ID modification, information and title. The one visible field that we know we always see. So I have a really short list of what I can work with here in the builder. Nonetheless, I want to create a subject, because an email message needs to have a subject. And so we could say, confirmation your item and we can put in the title now, because we know we have that. Was received. And we could say a little bit more if we wanted to, we could say, the item you submitted or posted, and then we could put his title in again. Was received on. And that would be the created date. We can send that out as a long date, we can send it as a string, I kind of like long date. Click here to view your item. And we'll always know we have an encoded absolute URL. Might want to put that on a line by itself. There we go. So, we're limited in terms of what we can do when we don't specify that we want to use the particular content type. A content type gives us access to known columns. But, we have a few things that we can do to create a reusable workflow and these are the steps to create it. Here's our workflow, then it needs to have a way to get out of this last state. So we're going to go to a stage and that's going to be the end of the workflow. And we might want to add something to our workflow log as well. That's not always a bad thing to do. But I'm all set, I'm going to check for errors. I don't have any. We're going to publish. And this is publishing not to a list or a library, but publishing to the site. We're creating this in the Human Resources site. It will be saved in the Human Resources site. When I get ready to use this workflow, I'll call it up in the same way that I would invoke that three state workflow. Let's go back to our SharePoint site and for example, if I wanted to use this in the Articles Library, I could go to Library on the ribbon, WorkFlow Settings, Add a Workflow, and my e-mail submitter workflow is right here in the same place that I found my three state workflow. Now, it's called email submitter. I have to enter a name for the workflow in this particular context and say that I want to call this maybe Email Article Submitter. Could give it the same name but in the same way that I didn't call the three state workflow three state. And I'm going to say creating a new item will start the workflow, say okay, and I'm going to have this new workflow now, running here in this library. That's all the harder it is. So, reusable workflows, relatively easy to create and very easy to deploy. If you look for more information about reusable workflows. Make sure that you're looking at information about reusable workflows in SharePoint 2013. It's very different than 2010 and there are folks who will say that reusable work flows were more powerful in SharePoint 2010. That we could associate them with content types, and do other things like that, that aren't possible in the SharePoint 2013 workflows. So make sure, if you're looking for more information, that you're specific as to version.

Creating a Site Workflow

The last type of workflow that we're going to create is called a site workflow and unlike our list workflow and our reusable workflow the site workflow is independent of all lists and libraries. The reusable work flow was created without a specific list in mind. But in order for us to use it, we had to invoke it would like we would a three state work flow. But the site work flow, it's out there on it's own. Now this was a new feature in Share Point in 2010. And what's happening with Site Workflows is that the majority of them are being used for a small set of pretty predictable circumstances. One is when we want to be able to run some kind of report on the site that does a role like maybe keep performance indicators, how many users, how much time was spent, those kinds of things, number of new documents. And so to have a report done on a site. Because a site workflow can actually look in every list, and count the number of items that are there, or look in libraries, and find out how many new Excel documents were in there. So, these are within the scope of a site workflow. The second thing that site workflows are used for, is for things that have to be scheduled at particular points in time. So, to do something on a routine or a periodic basis. The third purpose for site workflows are the governance purposes, to be able help someone provision a site, to have a workflow that walks a user through the steps that are necessary for them to set up a new site and set up the permissions, those kinds of things. So, those are the arenas where site workflows are being used. Because we actually have the greatest use for list work flows and that's why we've spent most of our time on them. They're the work flows that we use to be able to move work through the business. But site work flows are interesting and they have a couple of different features. So we're going to create a site work flow. And our story here is that we'd like to be able to capture feedback about our SharePoint site, and we want to make it really easy. This is almost like writing on the back of a napkin and throw it under the door. We're going to ask the user what they would like to have us put in the site, a new feature that they would like to have. And that's about it. So, we're going to create a new site workflow that says HR site feedback because I'm in the HR site here. And this is demonstration, first of all, and we're going to gather feedback from users on the new internet site. It's a fine description. Just hit okay and here we are and we have one stage which is were going to. So what I'd like to do is go back and take a look at the HR site feedback. Notice that there are a list of forms that are used by this workflow. And there aren't yet. But what I'd like to do is I'd like to save this workflow right now. Right where we are. With very little done to it. Because that's going to allow us to do a few other things that we would like to do next. So, let's go back into Edit Our Work Flow. And we want to set up what are called initiation of form parameters. These are lot of like local variables. Except what we're saying is, we want to create a local variable and a control for it on a default form. So the very first item that we want done is the text of the feedback that they're going to provide. And the description here is user remarks about the site. Now let's give' em multiple lines, but not a million of them. There's no default value so there we go. So it's going to show on the initiation form and it's called feedback. Let's add one more, which is suggestion, multiply into text. Do you have a suggestion, for a new feature, on the site. It's cool. Just click next, no default value, say finish. So we have two initiation form parameters laid out here. And I'm going to say OK. And we're going to have really just one action. After we've created the parameters and we've gathered some information, what we're going to do is we're actually going to email that to the user. So gather info, and email, I'm sorry I said to the user, we're going to gather this information and we're going to email it to a suggestion email, so we know how to create this, send an email. Email these users, we actually have an email address for where our suggestions go. It's going to go to suggestions@insidenoi. Now that's where it's going to go in the long run, but I'm also going to copy this to myself. And we know they may not be valid, so that I can see what's going on here for right now while we're testing. And the subject could be new feedback slash suggestion received. And if we want to know who it's from we could fire up the builder and we could say it was received from. Now there is no current item so don't be looking for current item and then create it or modify. The only place that we'd really have to look is in a place called workflow context. These are announcements, other things. Then we'd have to say where we would find them. I mean take a look. These are all of the lists we have. But the workflow context will actually give us an initiator and that initiator is the login name of the user. We can also return initiator as an email address or as a display name and we tend to like display names so that'll work really well. New feedback suggestion for HR site received from. And here's that person. And let's imagine that we're a pretty large organization and we can say whose email address is. And let's go right back there, and go to the Data Source of the Workflow Context, and this time let's grab our initiator's email address. Okay, now that's a long chunk here. And let's say, that we're not going to enter the feedback. And we have that. Where's that coming from? Well, it's coming from our work flow variables and parameters. Our paramter are there too and so the feedback is the first piece as a string. And our suggestion is the other parameter. There we go. We have a new piece of feedback/suggestion for the HR site received from. Alright, and, these perimeters disappear just in the same way local variables do. So, we want to make sure that we're doing something with them. We could write to a list from here, it's possible to do that. But if we were going to bother to that at all where it all went into one list, I think my tendency would be just to create the list. And to create a more standard list workflow. So we have all of this sitting up here in this String Builder. And I'm actually going to cut this, right after the name of the contributor, cause I got so busy talking to you, that I didn't realize that I was creating just the subject. So now we'll fire up the body of our email. We have this person's name, but we can say Initiator. And remember that we're finding that person under our Work Flow context as the Initiator. And we'll use their display name. And we'll put in their email address. Going back to the workflow context, grab an initiator this time using their email address. And then we have feedback that they provided. And we'll find the feedback in the workflow variables and parameters. And if they provided a suggestion we'll assume that they did, we'll go get their suggestion text also in our workflow variables. Technically in our initiation form parameters. There's our suggestion text. Good. Hope we like this. I'm going to say okay, and remember that we have to have a way to get out of this stage, so we're going to go to a stage, and the stage will be the end of the workflow. There we go. No errors, let's publish our site workflow. So now, let's go use our site workflow. And to do that, we're going to go to the site. So here we are in our HR site. You might wonder, where is it? Well, let's go to our site contents. And here are our site workflows. So I'm going to click site workflows. We have one that's available. And I can start it right here, HR site feedback. And the first time you run this it might take a moment, because remember it's setting up some parameters and actually creating a form on the fly that didn't exist until just this moment. So the feedback is great site. Thanks for all the hard work. And my suggestion is, would like a list of key HR staff with presence, on home page. Notice that the descriptions appear below the boxes, and that i've got a default size of about oh six or seven lines there. Now you'd think this would say save but it is actually saying start because we're going to start the work flow. That's it. So, we captured information and it's on its way to somewhere and the somewhere it should be on its way to, is it should be appearing in my inbox, because I was copied on this. It's also going to the suggestion box that was set up for the site, and here it is. New feedback suggestion for HR site recieved from Gini Courter, initiator, my email, feedback. Great site, thanks for all the hard work, suggestion. Just like that. So this is how a site workflow works and where its position and where you run it from. This probably isn't something that I would create a site workflow for, for a number of reasons. One of them is that I actually like this kind of information to be kept someplace all in one list. But it's a nice exercise and it lets you see that site work flows are indeed quite different from our reusable work flows and our list workflows and yet the process for creating them is very, very similar.

Packaging a Workflow in SharePoint Designer

SharePoint Designer 2013 gives us the ability to save a workflow as a template. When we do that, it's called packaging a workflow. And after we've packaged the workflow we can use that workflow in other SharePoint servers. Other server farms, other sites, without needing to build the workflow all over again. So if we're creating SharePoint 2013 workflows, reusable workflows, list workflows, site workflows, can all be packaged. If for some reason, we've been creating SharePoint 2010 workflows, the only one of those that can be packaged, or saved as template is a reusable workflow. This was our HR Site Feedback workflow, and I just made a couple of little changes here. I modified the name from HR Site Feedback to Site Feedback. Changed the description slightly. I could check it out and make sure all the rest of it is exactly what we'd like it to be to, so we could edit the workflow. And take a look at its form parameters. There's feedback, it says user remarks about the site. We could do what we did with the other and say. What feedback, do you have, about the site? We could also ask something more specific like, what amazed you the most about the site? And let's take a look at the suggestion. Do you have a suggestion for new features? So nothing mentions HR here. It's all pretty generic. Let's go ahead and publish this again. Because now, rather than create this, you know, more than once. I have a suggestions box here. That's going to suggestions, for the whole organization. Why not reuse this in more than one site? They could use this in the finance site. We can use this in the main Internet site. So, you want to make sure that you're looking at your workflow's settings. Because it's on the workflow settings tab of the ribbon that we're going to find save as template. And it says the template has been saved to the site assets library. That's over here, you can actually see it. Let's go ahead and refresh, there it is. Sitefeedback.wsp. That's the extension for. A workflow package. It stands for web solution package. So that's how we have packaged this up. And we can now use this elsewhere. But we have to be able to deploy it first. And that's what we'll do in the next movie.

Deploying a Workflow in SharePoint

The web solution package that we created can be deployed on any site collection. But that's the level at which it's deployed. It's not deployed on a site. So interestingly enough, we created this, and it lives on this HR site. But to get it on the sport team site or the finance site, or even on the main page of our internet, we can't put it on those sites specifically where we need to place it is in the site settings for the entire collection. So we'll go to our top level site settings. And here we have solutions, and this is where we'll place it. But first we have to save it. So, lets go back to our site assets. We have couple of ways that we can do that. We can do that in Share Point designer, probably the easiest way. And here is our site feedback WSP. There's all the information about it. So I'm just going to click this once and I'm going to choose export file. And I need to put it somewhere. Doesn't really matter where will I put it for right now, but I need to be able to find it again. It seems unfortunate to put it on the desktop, but I'm actually going to do that, and I'm going to tuck this into my exercises folder, for chapter 13, which is where we are, I'm going to save it. It's been successfully exported. We are happy people. Now let's go back to that site collection that I showed you. We can just slide back over to our share point site and go to site settings. We can go to the top level site settings. And under web designer galleries choose solutions. We actually have one solution here already. So this is how we deploy different types of packages. They're not all going to be, for example, work flows. We can deploy other types of solutions here as well. But the first thing that we need to do is upload it. It asks me where it is. And I know where I put that which is I put it on the desktop, in the exercises files. Now this means that because I put it there, even if you didn't create it, you can do this piece, right? This is a standard check box that we see in SharePoint. If you believe this is here already and you don't want to override it, turn it off. And that way it will be checking for you. So, we now have it in our Solution Gallery. And, we're going to activate it by clicking this button. This is actually a ribbon that we have here. And, we have a new site feedback work flow solution here. So now, let's go to a site and actually use it. I'm going to go to the finance site. It's a nice little site with almost nothing going on there, like I said. And we're going to go open up our site settings. And in the site actions group, we're going to manage the features that are available on this site. And if we scroll down to W for workflow. Workflow template site feedback from a web template human resources, that's the one that we created, we're going to activate it. It's activated now. It shows as active. So now, in this site, if I go to my site contents, site workflows, there it is. I actually think this is pretty amazing. The ability to be able to package a workflow, and put it someplace else. Now, we used a site workflow this time. And that was actually pretty easy because this site work flow has no association with a list or a library. And that means that the environment in which this Workflow operates, is easily created. All it has is initiation form parameters. If I want to take a workflow for a list or a reusable workflow and be able to package and deploy it in this way, I need to make sure that where I am going to place this has all the same type of access. If it relies on a list named departments when I package it up. Then, wherever I put it had better have a list called Departments that has exactly the same fields that are being relied on. So, if I'm packaging and deploying work flows that are not site work flows, it gets more complex. Because I have to make sure that I have everything that's required. Where as a site workflow, as you've noticed, doesn't need a whole lot. This is how this works. We've been able to deploy and know would actually be able to use this workflow right here. Just fire it up. Looks amazingly familiar, doesn't it. This is how you package and deploy workflows to be able to move them between SharePoint sites, between site collections, and even between different SharePoint farms.

Creating Workflows Visually

Creating a SharePoint Workflow in Visio 2013

If you have Visio Professional 2013, then you can use it along with SharePoint Designer. And the combination of these two tools together makes it easy, not just for you but for folks you work with like, business analysts or people who are working on process improvement with you, to participate by creating drawings using a tool that they're probably used to using, Visio. And, you can then automatically take those drawings into SharePoint and further customize them. So, here we are in Visio 2013. To create a workflow, you can't just use any template. There are a number of templates available, this is only a few of them. Visio is filled with different templates for you to use, but, if you're going to create a workflow, you have to begin it using the SharePoint Workflow template. If you start it with any other, there's no way to convert it. So, you open Visio, and you choose to use the SharePoint 2013 Workflow, and click create. Now, this is, as is every other Visio template, there are two versions. There's a, a metric version, and a US units or, inches, feet, and so on, version. Make sure you're making the right choice here, based on who your other partners are that you're working with. It's just kind of nice. It doesn't really affect our workflow, but it's still kind of nice. And click create. So the template opens up, and our page or our drawing canvas back here has, already, a stage shape, that's what this is, and two terminators. So we have a start, here, and we have an end, that's what these two items are. So the green triangle is to start, everything else that we put into this workflow is going to fall between that start and that end. What we'll do is, we'll drag the items that we want into this stage, onto this canvas. If we want to rename something like Stage 1 we'll just double-click to change its name here. The workflow that we're going to create is actually an approval workflow. And, it might behoove us to take just a moment and take a look at the list, that already exists, that we're going to be automating with this workflow. Here's the Employees and Hours list, and this is similar to a timesheet list that we saw earlier. When an employee turns in their payroll, they'll enter here, their last name, their first name, their employee number, their week starting date, which is calculated to go back a week for us to make it easy, the number of hours, the rate, and department that they are in. These two items are also fields in the list, they're columns. These last two columns in the list are not going to appear on the form that the employee uses, but I want you to see them, so I left them here for you. The question is, has this payroll been authorized, and if so, by whom? The rule is that as long as the hours that are reported are less than or equal to 40 hours, then we're going to authorize the payroll. Now, we probably also don't want them being able to increase their rate. Oh, it's time for the holidays, I need a little extra money, I make $1,000 an hour this week. No, we'll probably have some rules about that too, but we could validate that in the column. What we want to be able to do is, when an employee enters, for example, that they worked for 42 hours, we need somebody to authorize it, and that's the only way this payroll is going to proceed. And we need to know who authorized it, so we're going to send an email to the person who's responsible for authorization in that department, that's why we need to know what department they're in. It's a pretty straightforward workflow. We've used all the parts and pieces of this. So, what we're going to do is we're going to look for a value in hours, we're going to find out if that value is greater than 40. If it is, we're going to send an email with an encoded absolute URL to get an authorization. If it's not more than 40 hours, we're going to set the value of Authorize to true ourselves. We're just going to have the SharePoint workflow click that off. So, this is where we're going. Let's head back now to Visio. Now, we don't have access, here, to all of those columns. This isn't tied directly to SharePoint in the way SharePoint Designer is. So, we would need to keep track of all of the different things, the names of the columns, everything else, or at least have a handle on what we're doing with those. So, the first thing that we have is, we have an action. And the action is that we want to go in and create just a quick log in our history list, that says what that value is. So we're going to just take the value out of the current item and say that the number of hours is X. Then, we need to create a condition. And the condition is one of those if any value equals values condition. And, before that even, because remember that, if any value equals value, actually has to be equals, it can't be greater than or less than. So, what we really need first is to have a calculation that is going to let us know whether or not it's going to return a true or a false. So we have to put in a Du calculation, and we'll slide that in ahead of time, notice how that worked. So we're doing a calculation, and then we're finding out if any value equals value. And, if it does, then we can simply set the field in the current item. Now I'm running out of room here, so I'm going to undo that. We're sort of bound by the pages, so this is the physicality of Visio, is that we're still on this page and we're just making this page really, really long, so that's okay. I'd like this, actually, up, just like that. So, if any value equals value, and we have a couple of different possibilities here. So, if we say, yes, it's greater than 40, well, then our next task is going to be to send an email. But if it's not, we're simply going to set the value of Authorized equal to true. I can take this connector here if I wish, and drag it down here. That's great. The other possibility is, I'm going to send an email. And it's fine for me to connect these, right there. And, if I send the email, then I'm going to set the field in the current item as a result of that email. But before we can set the field, we actually have to wait for that value to change. Now, that’s not waiting for an event, that’s actually wait for the value. Wait for field change. Right there. And I’m going to need to connect these up. So, one, two. This one connected itself, and I really don't want that connection here, so we'll hang on to it for a second. I'm going to grab the pointer tool. Now, if you're not putting conditions in a workflow, this is just like click, click, click, click. But as soon as we have to do two different things, it gets a little more complex. Here we go, we're on our way out the door. So, this is one long stage, we're doing everything in one stage in this work flow. We could put in more stages. We have these component shapes, as well as the actions and the conditions. Here are our components. So we have stages, we have loops, we have steps, and so on. This is not a parallel process. We have a parallel here, but that's the same as if we are going to do a parallel block, for example. I think we're looking good, I want to save this. And I'm just going to save this on the desktop. And, our workflow is a workflow to authorize over time, but we're doing all of it, so we're going to, actually, authorize, payroll item. And I'm going to save this. Now a couple other things before we leave Vizio. This isn't the only type of diagram that I can create, and all the diagrams are built using stencils. So, these are stencil sets, actions, conditions, components, and then there are this list of, of Quick Shapes, which is all of them together. There are more shapes that are available. There are floor plans, and there are flowchart plans, but if you use any of these that are not part of the SharePoint template itself, then this isn't going to work. So even though there might be compelling visual reasons to say, I'd like to create something that looks a little spiffier using these other icons and these other stencils, remember, that for all of this to work, you have to use the Sharepoint 2013 Workflow template, and you are constrained to the sets of shapes or the stencil libraries that come along with it. But this is looking good, I like this. And I've saved it, so this is how I can create my basic workflow in Visio 2013.

Validating the Workflow in Visio

Before we take this workflow over to SharePoint to open it, we're going to validate it here. Which is to make sure that it meets the rules for a valid SharePoint workflow diagram for SharePoint 2013. In order to do this, you open the diagram. And you go to the Process tab, and choose Check Diagram. And the rules to check for this are SharePoint 2013 workflow. That's the template that we created this with. We can import a set of rules. You could have a complex set of rules that were created in your particular organization, for how workflows had to be designed. But we're simply going to check the diagram. And it says we have two issues, that we need to resolve. One is that this condition shape does not have connections labeled with yes and no, and the other is the yes and no, so that's great. Whenever we come out of a condition there has to be a yes possibility and a no possibility. So what we need to do now is know right now, unless we want to change it later on. Do we want to create this condition in such a way, that yes is sending an email? So we would say the hours are greater than 40. Yes. Alright, or if we want this to be the no condition. But I'm going to set that as the yes. Notice that if I check the diagram again. Now I only have one issue. That's cool. And this one, I just need to type no on it. If type yes on both of em, it'll create a problem. Double click the connector. Don't need to press Enter, just click somewhere else. Let's check the diagram one more time. Diagram validation is complete, no issues were found in the current document. That's great. I can close this Issues window now. I can save this again, knowing that we're all happy. And that is because I have been able to validate this workflow in Vizio and I'm now ready to switch over to SharePoint Designer and open it up there.

Importing and Customizing a Visio Workflow in SharePoint Designer

I can create a workflow for SharePoint in Visio, but I can't finalize it and I have no way to publish it. So, this is set up, so that you could have a BA, business analyst, or a developer, or even some folks who are working in the business but good with Visio, using Visio to create. The framework, the stages. And they could have great discussions about it using that Visio tool to design it. But they can't publish it from there. That requires SharePoint Designer. So what I want to do now is be able to open and customize and publish the workflow that I've created. First I need to make sure that I'm in the site that I want to be in. I am. I'm in my Human Resources site. That's great. And what I need to do is create an empty work flow to put this work flow into. It's a little weird but. So what I'd like to do is I'd like to create a work flow. I want to create a list work flow, for our employees and hours list. And, I need to give this a name, and it does not have to be the same name as the diagram. So, you could have business analysts cranking out diagrams that have number prefixes and all this stuff, but we don't care because what we're going to do, is we're going to create a work flow that says authorized payroll item. So it's for a specific item and this, let's say that if the hours are greater then 40 that we're going to email the department for authorization to pay. Alright, that's great. Say OK. Here's our new workflow. Now, we know what to do with this, we could simply start creating a workflow. But, no, no, no. We're not going to do that because we already have one. It's on the way. So, we could also, by the way, do this for a site workflow. It doesn't have to be for a list workflow, we just happened to choose a site workflow here. I need to now go to the workflow settings. Here they are. And I want to Import from Visio. And there is my authorized payroll item. I'm going say OK. You're going to see this message every time. What it says is, you've already got a workflow, you just created it. And it's not bothering to notice that we haven't put anything in there. It's empty. But it says, any time you import a work flow from Visio, it gets rid of any actions you have in your current work flow. Fortunately we don't have any. Yup, we're certain that's what we want to do. And here comes our work flow. Just as if we were in Visio. It's actually Visio running, inside of the SharePoint Designer and it's called the Visual Designer. A reminder that if you didn't have Visio on your computer, none of this is going to work and it has to be on the same computer with the same authorization if you're using a subscription, for example. That SharePoint Designer has. So I have my zoom tools here, so I can say that I'd like this to fit in the width of the page, for example. It's going to look very familiar. Now, if I wish, I can swing over to the text-based designer. And I love this, now, because I know exactly what to do here. I can rename my stages. These are just two views. Two different design tools that I'm bringing to bear on the same workflow. Switch back to my Visio visual designer, and we're back again. Now, I can do some work here. i can set this, and there are plenty of people who love Visio, and they do all of this in Visio, from the start, every single thing that we've been doing. Because, they'll go to Message. And they'll say, oh, I know what to do here. I'm going to click on the builder and it's the same string builder that we've been using to build messages. Not only do we have a message, we have properties. So we can have parameters for the message. This is the message to log to the history list and we can create that message here. So at every point, we have the ability to complete this diagram here, if we wish. Or, switch back the text based designer, it's the same thing. Log message to the workflow history list. And we know how to build this here. We know how to rename stages. So if I rename this stage, and I say that we're going to calculate and request approval. That's cool. Save this. It's good to do that from time to time anyway as a practical matter. And notice in my visual designer, my name's changed right here. There's my calculate and request approval. So, continue doing all the work that you want to do here, so that this is done. If you check for errors occasionally, I will tell you that I've checked for errors in a work flow like this. And I have lots of errors that have talked about shapes, but they're not real errors. So, make sure that you have met all the requirements. Of the work flow before you get ready to publish it. And you can double check that here in the text space designer, if you wish, that every place you have a hyperlink, you need have, to have filled in that information. But when you're ready to go, you can save and publish this workflow and it will run just as if you had started creating it from the beginning. In SharePoint Designer, rather than starting this in Visio. One more note, and I think it's fairly obvious. But if I were to create a brand new workflow, anywhere here. I'd go back to my listen libraries and I say, well, for the HR links I'd like to create a workflow. For example. And I'm just going to say sample here. So we can see this, but if you like that visual environment, it's available to you right here. You don't have to start in Visio, you can start bringing Visio into SharePoint Designer.

Conclusion

Next Steps

We've reached the end of our course. But this is only the beginning of what you can do with SharePoint Designer. It's only the beginning of what you can do with SharePoint. And so what might your next steps be? First, if you have not created a workflow for your organization while you were looking at these movies, begin to look around for an opportunity. And, I want to encourage you to choose some opportunities that are easy first. Sometimes when I work with someone who wants to build a workflow, they know what they want to automate. And it's one of the most difficult processes in the organization. Look for some easy things first. So that you can build to your own experience. So that you can use those easy opportunities to test and make sure that, for example, email sends properly from SharePoint to users. So that you can build a relationship with not just your business users, but with your exchange administrator, and so on. So choose some low hanging fruit. And start there. And then, as you gain experience, continue to build workflows that are more complex. And that solve the problems in your organization. What might you want to learn next? Well, I have some recommendations there, too. If as we were working with SharePoint, you found that you would like to have some more information. Or just a deeper level of understanding of how SharePoint itself works. I want to recommend SharePoint Server 2013 Essential Training. Or if you're using the subscription version as I have been. SharePoint Online Essential Training, both in the lynda.com training library. If you love SharePoint Designer, you don't have to limit yourself to workflows. You'll find a course on Branding SharePoint sites. And another course on Creating Data Driven Web Pages, in the lynda.com library. As of the release of this course, the versions that were there are for 2010. But, there's not that huge of a difference, particularly around data-driven web pages. So, feel free to look at the 2010 versions of those course, or the 2013 when they become available. If you liked the other two tools that we were using InfoPath for form design, whether its modifying the built in forms or creating new forms. I'd like to recommend of course, the InfoPath 2013 Essential Training course. This is another one of the courses that I developed and there is so much you can do with forms. And as your workflows become more complex, you'll want to create a richer user experience with forms. So, if you are a SharePoint developer and you are not a visual studio person. I want to encourage you to add InfoPath development to your skill base. If you liked Visio, there's a wonderful Visio 2013 Essential Training course in the lynda.com library. Not only can you use Visio to create workflows. But Visio is a wonderful tool to be able to create diagrams that drive conversations among users. As a matter of fact, every diagram that you saw in this course was created in Visio. Even though many of the diagrams were not created to be used as SharePoint workflows. So, you have lots of possible avenues to explore. And lots of future activities that you could engage in. It's truly been a privilege and an honor to provide this information for you. And I hope you have a wonderful time putting SharePoint Designer and the other tools to work to solve real world problems for your organization.