SharePoint 2010: Workflows with Nintex ©2013 SharePoint 2010: Workflows with Nintex 1.0.0 72 Pages About IT Training The University Information Technology Services (UITS) IT Training program at Indiana University offers instructor-led computing workshops and self-study training resources to the Indiana University community and beyond. We deliver training to more than 30,000 participants annually across all Indiana University campuses. Our staff is comprised of enthusiastic professionals who enjoy developing and teaching computing workshops. We appreciate your feedback and use it to improve our workshops and expand our offerings. We have received several international awards for our materials and they are being used at universities across the country. Please keep your questions, comments and suggestions coming! In Bloomington, contact us at ittraining@indiana.edu or call us at (812) 855-7383. In Indianapolis, contact us at ittraining@iupui.edu or call us at (317) 274-7383. For the most up-to-date information about workshops and schedules, visit us at: http://ittraining.iu.edu/ Copyright 2013 - The Trustees of Indiana University These materials are for personal use only and may not be copied or distributed. If you would like to use our materials for self-study or to teach others, please contact us at: IT Training, 2709 East 10th Street, Bloomington, IN 47408-2671, phone: (812) 855-7383. All rights reserved. The names of software products referred to in these materials are claimed as trademarks of their respective companies or trademark holders. Contents Welcome and Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 Calculating a Date . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 What You Should Already Know . . . . . . . . . . . . . . . . . . . . 5 Configuring the Calculate Date Action with a List Lookup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 What You Will Learn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 What You Will Need to Use These Materials . . . . . . . . . . . 5 Getting Started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 Getting the Exercise Files . . . . . . . . . . . . . . . . . . . . . . . . . 6 Finding Help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 Want to Learn More? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 Today’s Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 Understanding Workflows . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 Creating Workflows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 Creating a Site from a Template . . . . . . . . . . . . . . . . . . . . . 8 Activating Nintex at the Site Level . . . . . . . . . . . . . . . . . 10 Exploring the Nintex Interface . . . . . . . . . . . . . . . . . . . . . . . . 11 Configuring A Workflow . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 Exploring Workflow Settings Options . . . . . . . . . . . . . . . 15 Automatically Starting a Workflow Via Modification 16 Creating A Simple Workflow . . . . . . . . . . . . . . . . . . . . . . . . . 20 Configuring a Flexi Task . . . . . . . . . . . . . . . . . . . . . . . . . 21 Configuring the Task Notification . . . . . . . . . . . . . . . 23 Understanding Flexi Task Options . . . . . . . . . . . . . . . 24 Adding a Notification . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 Configuring the Send Notification Workflow Action . . . . 25 Reusing Workflow Actions . . . . . . . . . . . . . . . . . . . . . 30 Publishing a Workflow . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 Creating a Complex Workflow . . . . . . . . . . . . . . . . . . . . . . . . 32 Building a Workflow Efficiently . . . . . . . . . . . . . . . . . . . . . . 35 Understanding Variables . . . . . . . . . . . . . . . . . . . . . . . . . . 36 Adding and Configuring the Create Item Action . . . . . . . 41 Using A List Lookup . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 Staying Organized With An Action Set . . . . . . . . . . . . . . 44 Working With Comments . . . . . . . . . . . . . . . . . . . . . . 45 Using Copy/Paste in Nintex . . . . . . . . . . . . . . . . . . . . . . . 46 Challenge: Edit Actions to Build a Workflow . . . . . . . . . 48 Testing a Workflow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 Debugging a Workflow . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 Using Site Workflows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .50 Creating Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 Calculating a Date . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 Understanding Collections . . . . . . . . . . . . . . . . . . . . . . . . 55 Using Collection Variables . . . . . . . . . . . . . . . . . . . . . . . . 57 Populating Collection Variables With Query List . . . 58 Using a For Each Loop . . . . . . . . . . . . . . . . . . . . . . . . . . .61 Using Collection Operations . . . . . . . . . . . . . . . . . . . . . . 63 Configuring a Collection Operation . . . . . . . . . . . . . . 65 Building a String . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66 Creating the Final Output . . . . . . . . . . . . . . . . . . . . . . . . . 68 Challenge: Create the Final Output . . . . . . . . . . . . . . 68 Challenge: Send Final Notification . . . . . . . . . . . . . . 69 Scheduling A Site Workflow . . . . . . . . . . . . . . . . . . . . . . 69 Wrapping Up . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 Contributions to These Materials . . . . . . . . . . . . . . . . . . . . . . 71 Welcome and Introduction Welcome to SharePoint 2010: Workflows with Nintex. What You Should Already Know You should have already attended SharePoint 2010 Site Administration Basics or have the equivalent skills. Specifically, you should be able to: • create a SharePoint site • create lists and libraries in SharePoint What You Will Learn In this session, participants will see how to create workflows in Nintex to automate SharePoint functionality. These workflows are very powerful and can make business processing much easier by automating file creation, task completion, and notifying stakeholders in a site. We will see how to create workflows, where to create them, and create a few simple workflows and see examples of more complex workflows. Participants will: • explore the Nintex interface • create workflows in Nintex • see how to use workflows to automate SharePoint processes What You Will Need to Use These Materials To complete this workshop successfully, you will be provided with: • The use of SharePoint 2010 with Nintex Workflows installed SharePoint 2010: Workflows with Nintex 1.0.0 5 Getting Started These materials presume you will begin work from the desktop, and have any required exercise files located in an epclass folder there. Getting the Exercise Files Most of our workshops use exercise files, listed at the bottom of page 1 of the materials. In our computer-equipped classrooms, these files are located in the epclass folder, which should already be on the computer desktop. If you are using our materials in a different location, you may obtain the exercise files and detailed installation instructions from our Web site at: http://ittraining.iu.edu/downloads/ Once you are logged on and have the needed files in an epclass folder on your desktop, you are ready to proceed with the rest of the workshop. Finding Help If you have computer-related questions not answered in these materials, you may look for the answers in the UITS Knowledge Base, located at: http://kb.iu.edu/ Want to Learn More? IT Training offers many training options for extending your skills beyond this workshop: • Self-study training: You may access computer-based training from leading commercial vendors, obtain the materials for other STEPS workshops, or access IT Training’s own tutorials on a range of topics at: http://ittraining.iu.edu/online/ • IT Training Tips weblog: Our award-winning blog has short tutorials and training posts on a broad range of topics and technologies. It’s written by training and support providers from across the entire IU system; you may read and comment on these at: http://ittrainingtips.iu.edu/ 6 SharePoint 2010: Workflows with Nintex 1.0.0 Today’s Project In today’s workshop, we will be exploring the SharePoint workflows with Nintex. Nintex is a plug-in for SharePoint that allows us to build complex workflows with a visual interface. Today we will work with many of the individual modules available in Nintex, and see how they can interact with SharePoint lists. We will create a simple workflow to approve a document, and then create a more complex workflow that allows interaction between two lists. We will also cover how to use variables, calculate dates, and loops. Let’s begin by discussing what workflows can do for us. Understanding Workflows Workflows are used to automate process in SharePoint sites. Sometimes this can be as simple as sending a notification to an individual or group when an item is changed. In other cases, they can be used to process data in SharePoint lists, shuffling the data to other locations, or updating data within the list. Workflows can also be used to mimic database and web application operations within a SharePoint site. Let’s look at an example. You have a list that creates a record of a project. This can contain information like the project owner, the name of the project, and the final project due date, and any additional staffing that is needed. However, this project will need a schedule of milestones leading up to the final date. We could design a workflow that takes the information in that project record and creates a schedule based on a standard model. This workflow would then add milestones to a Tasks List that includes the name of the milestone, the deadline for that milestone, and who is responsible for that milestone as well as some kind of key column that would associate these milestones with a specific project, much like a database would. This workflow could then send a notification to each of the project team members, giving them a list of the project schedule. This data would then be stored in the SharePoint site, where it could be accessed by all of the project team members. This workflow could either be designed to activate when a new project record was added, or could be run manually by the project leader or another staff member when they were ready to proceed. Now that we understand what we would use them for, let’s see how they are created. SharePoint 2010: Workflows with Nintex 1.0.0 7 Creating Workflows Nintex Workflows are created with a visual interface that allows you to press and drag individual modules representing actions into a visual workflow. Ribbon Drag Workflow Actions Here Workflow Actions These actions will be executed in order. We can also use basic programming concepts like if statements to make decisions within the structure of the workflow. Workflows can be created in one of two places: on a list, or at the site level. List workflows can act automatically when an item is added or modified, and are frequently used to process data within the list. Site workflows are manually activated and can be used when a workflow doesn’t need a specific list item created to work. NOTE: Of course workflows can also be created in libraries, but since they work identically to lists in most respects, we will only use the term lists. Let’s begin by creating a list. Creating a Site from a Template We’ll begin by creating a site that we can each work on throughout the workshop. This site will be based on a template. We will open our SharePoint site to begin. 8 SharePoint 2010: Workflows with Nintex 1.0.0 1. Open Internet Explorer. NOTE: Nintex Workflows can only be created in Internet Explorer version 8 and later. Any other browser will not be able to access the Nintex features. 2. To open our SharePoint site, in the address bar, type: http://www.sharepoint.iu.edu/sites/umwadv/ © The site opens. NOTE: In today’s workshop, we are logged into demo accounts that will log into SharePoint automatically. At your own workstation, you might need to provide a user name and pasword at this point. Let’s create a site. 3. To begin creating any object, in the SharePoint Ribbon, ™ , ™ Create New Site The Create new object window appears. We have a template created that has our columns created. Let’s select it now. 4. To select our site template, in the dialog box, ™ Nintex Basics May-13 We will use the demo username located in the upper right corner of the screen. 5. To name the site, in the Name field on the right side, type: username’s site 6. To add the URL, in the URL field, type: SharePoint 2010: Workflows with Nintex 1.0.0 username 9 The username you will use today is located in the upper right corner of the screen. 7. To create the site, ™ The site is created and appears. Before we continue, we have to make sure that Nintex is turned on for this site. Activating Nintex at the Site Level For each site we create under our parent site, we must activate Nintex at each level. Nintex has been activate at the top level, so we can use it here as well. Let’s do this now. 1. To move to Site Settings, in the menu bar, ™ The Site Settings options appear: , ™ Site Settings We will use the Manage Site features option. 2. To manage site features, in the Site Actions sections, ™ Manage Site Features 10 SharePoint 2010: Workflows with Nintex 1.0.0 The Site Features appear. All we need to do is activate all of the items that are associated with Nintex. There are two today. 3. To activate a feature, in the list, ™ next to Nintex Workflow 2010 4. Wait until you see “Activated” appear next to the button. 5. To activate the reporting features, ™ next to Nintex Workflow 2010 Enterprise Reporting Now that Nintex is turned on for our site, we can begin working. Let’s look at our Quick Launch. We have a few lists already created here. We’ll use the Shared Documents library to create our first workflow. 6. To move to the Shared Documents library, in the Quick Launch, ™ Shared Documents Now that our site exists, we can create our first workflow. Exploring the Nintex Interface We will begin with a list workflow. This list will add a task and send a notification depending on who adds the list item. We can create workflows from the List tab. 1. To view the Library tab, in the ribbon, The List tab appears. SharePoint 2010: Workflows with Nintex 1.0.0 ™ 11 2. To begin creating a workflow, in the list tab, ™ , then ™ Create A Workflow in Nintex Workflow NOTE: If your monitor is large enough, you will see the words “Workflow Settings” next to this button. You will still click it in the same place. The Nintex workflow interface appears. We see a list of possible workflow templates to choose from. We’ll use the blank template today. 3. To begin the workflow, ™ The Nintex interface appears. We can see here that there is the standard SharePoint toolbar that will always be visible. Just below that we can see the ribbon. The Nintex ribbon allows us to do basic operations like Save and close, import and export, and change the settings. We’ll look at the Workflow Settings shortly. Along the left side of the screen, we see the workflow actions. These are the individual pieces we will use to create our workflow. They are broken up into categories that we can see in the bottom left corner. 4. To view more Workflow Actions, in the Workflow Actions panel, at the bottom, ™ Operations In this category, we can see different math and programming operations that help us to process data coming through our SharePoint site. 5. To select another category, in the Workflow Actions panel, ™ Libraries and Lists 12 SharePoint 2010: Workflows with Nintex 1.0.0 This category offers us ways to work with SharePoint libraries and lists. We can create lists and libraries, copy items, and other SharePoint actions. 6. To move back to Commonly Used, in the Workflow Actions panel, ™ Commonly Used There are many other categories, and we will discuss several of them later in the workshop. The interface is dominated by the Workflow View window. This is where we will build our workflow. We can see a green bubble to indicate the beginning of the workflow, and a red bubble to indicate the end of the workflow. In between these two bubbles, we see a small clear button. This is where we can add Workflow Modules to build our workflow. Each Workflow Action we add will become a step in our workflow, and they will execute in order, starting at the green bubble and ending at the red bubble. Before we add any actions, we must configure our workflow. Let’s do this now. Configuring A Workflow The first step to creating a workflow is opening the Workflow Settings dialog box and setting up some basic options about the way our workflow will run. No matter the workflow, we should always visit the Workflow Settings dialog box first. Knowing how the workflow starts is an essential part of building a successful workflow. Let’s open the Workflow Settings dialog box now. SharePoint 2010: Workflows with Nintex 1.0.0 13 1. To open Workflow Settings, in the ribbon, ™ The Workflow Settings dialog box appears: In this dialog box we can control how and when the workflow runs, along with basic information like the name and description. We can also see a ribbon in this dialog box that allows for some advanced options that we will discuss later in the workshop. Let’s start with a title for our workflow. This workflow will send a notification for items added to our list, so let’s name it after that function. 2. To add a title, in the Title field, type: Review Document Task 14 SharePoint 2010: Workflows with Nintex 1.0.0 Best practice is to always add a description to your lists, libraries and workflows. Without a description, it can become very complicated to figure out which workflow does what in the future. So we will want to add a description to all of our workflows. 3. To add a description, in the Description field type: This workflow will add a task to review the document and send a notification when uploaded. Now let’s look at some of the more advanced configuration options. Exploring Workflow Settings Options When designing a workflow, we must understand when it will be activated. The first step of any workflow is the user activating it. Since this is a list-based workflow, it will be run on a particular list item. We can decide at this point whether the workflow will run automatically when a list item is created, or whether we expect the user to run it manually when needed. We could also have it run automatically, and give the user the option to start the workflow manually. Let’s look at these options individually. • Start manually - If this box is checked, users will be able to start the workflow manually for an individual list item. However, for a list-based workflow, a list item must exist before the workflow will run. • Require manage list rights - This checkbox will force the user to to have security privileges to the list before they can run the workflow. This can be useful if you have a workflow that only a manager or administrator should have access to. • Start when items are created - If this dropdown is set to Yes, the workflow will run every time that an item is created in the list. This is a fairly common type of workflow, but we must carefully design around this concept. We can also set to Conditional which will allow us to automatically start the workflow, only when specific conditions are met. • Start when items are modified - This will also automatically start the workflow, but only when items are modified. We also have the Conditional opion here as well. • Publish without validation - This will allow the workflow to be published and usable without the validation step that can take an extended period of time. Using this option is not recommended, as missed validation issues can cause major problems when the workflow is running. • Enable workflow to start from the item menu - This will give users the option of starting the workflow from the list item’s context menu. The other options in this section are available when it is checked. This option is very SharePoint 2010: Workflows with Nintex 1.0.0 15 convenient when the workflow is expected to be started manually. • Enable custom history messages - This allows us to create custom history messages that can be generated by individual workflow actions. • Create workflow status column - This will create a column in the list that will link us to information about the workflow. This is very useful if the workflow creates an error, as we can easily click and see what has caused the problem. • Expected workflow duration - With this feature, we can set a specific length of time we expect this workflow to last for tracking purposes. • Task list - With this feature we can select which Tasks list we would like to use for any tasks we create with this workflow. By default they will go into the Workflow Tasks list that is automatically created, but you can create your own if necessary. • History list - Each step of your workflow is recorded as it is completed. This can help with error checking later. • Form type - This will allow us to use the default start form, or create our own via InfoPath. This option is only used when we are asking the user for input before the workflow is run. For this workflow, we want it to start automatically both when an item is created, and when that item is modified. 4. To deselect the Start manually option, in the dialog box, ™ the Start manually checkbox 5. To allow the workflow to start automatically, ™ the Start when items are created dropdown, then ™ Yes When we start with this option selected, we have easy access to the information within the item created. When we have this option selected, we should build the entire workflow around this concept. Now let’s see how to set up the workflow to begin when an item is modified. Automatically Starting a Workflow Via Modification While we want to the workflow to start again when an item is modified, we want to control how it starts. 16 SharePoint 2010: Workflows with Nintex 1.0.0 Let’s assume this workflow sends a notification to a manager to inform them that tasks are being completed. The manager will get an initial notification that the item was created, and they want additional notifications when progress is made on the task and it is modified. We want to be careful so that if the manager updates the task the workflow doesn’t restart and send unneeded notifications. Let’s see how to set this up now. 1. To set the workflow to begin when an item is modified, in the dialog box, ™ the Start when items are modified drop down, then ™ Conditional 2. To set the conditions, in the dialog box, ™ The Conditional Startup Options dialog box appears: SharePoint 2010: Workflows with Nintex 1.0.0 17 This dialog box allows us to select a field and compare it to either a different field, or a value that we provide. We want to compare the Modified By value to see if it was the manager. If it is, we will not restart the workflow. In this dialog box, the first drop down is always a field from the item that we want to compare to. The second drop down is the comparison operator. This allows us to change how the two fields are compared. The third field will either be a text box we can add a value to, or it will be another drop down. If we were to click the Compare to field? checkbox, then the third field would become a drop down that will allow us to refer to another data column. We will not do this today. Notice the line above the fields reads “Start when items are modified and:”. This gives us a clue about how to proceed. 3. To set the field to check in the first drop down, ™ the top drop down, then ™ Modified By 18 SharePoint 2010: Workflows with Nintex 1.0.0 You will notice that several fields allow us to check the Previous Value. This is useful if we need to check what the value was before the item was modified. One example of this is if you don’t want the workflow to restart if the same person who previously modified the item modifies it a second time. For today, we want to compare this to the username of our manager. However, the comparison operator box reads Equals currently. We want the workflow to run only when the Modified By field does not equal our managers name. Let’s change the comparison operator. 4. To change the comparison operator, in the Comparison Operator field, ™ , ™ Not equals Now we need to add our managers name. Let’s add the jump061 account name we used earlier. 5. To add the value to compare, in the blank text box, type: demo30, ™ NOTE: For today’s workshop, we will consider demo30 to be the ‘manager’. The name is recognized and we can continue. 6. To save the conditional, in the dialog box, ™ We see the Workflow Settings dialog box again. 7. To save the workflow settings, in the dialog box, ™ We have completed all of our configuration settings for this workflow. Let’s begin creating the workflow actions list now. SharePoint 2010: Workflows with Nintex 1.0.0 19 Creating A Simple Workflow Now that we understand the interface, let’s create our first workflow. We will create a simple workflow that adds a task, and then sends a notification. Let’s start by assigning a task to someone to approve the document. We add workflow actions by pressing and dragging them from the Workflow Actions panel. Once we have added the workflow action, we must configure it. Then we can continue adding more workflow actions, configuring them along the way. We will use the Flexi Task action to accomplish this. This action is used to assign a task to an individual and wait for a response (usually Approve or Reject). Once it recieves a response from the reviewer, it will take appropriate actions related to that document. 1. Ensure that you are looking at the Commonly Used Workflow Actions group. 2. To add a Flexi Task action, in the Workflow Actions panel, ¢ The Flexi Task appears on the workflow: to Notice that it has an alert icon next to the name. This indicates that the workflow action will not function properly because it needs additional configuration. For example, as we see in this intance, we have added a step in the workflow to assign a task, but we need to configure the action to assign the task to a particular person, decide which actions are possible for the task, and send a notification to the people involved. We can do this by double-clicking the workflow action. 20 SharePoint 2010: Workflows with Nintex 1.0.0 3. To begin configuring the workflow, £ The Workflow Configuration appears: Here we will configure the Flexitask to assign the task to the correct approver and what outcomes are possible. Configuring a Flexi Task Let’s examine this dialog box now. Like many SharePoint tools, Nintex workflows are configured with a series of web forms. We do not have to fill out all of the information in this dialog box, but it will be worthwhile to understand all of the options in this dialog box. We begin with the Assignees box. This will allow us to assign the task to either a single person, or a group of people. We can either list email addresses individually, or add an ADS group. Note below the Assignees text box, we can decide whether to add a single task for all assignees, or individual tasks. Which you choose depends on whether you need everyone to review a document, or you need anyone to approve the document. Today we will only have a single assignee, so we will only assign one task. SharePoint 2010: Workflows with Nintex 1.0.0 21 Let’s add our assignee now. 1. To add the assignee, in the Assignee text box, type: demo30@exchange.iu.edu We also see the Allow delegation checkbox. If this box is checked, the assignee will be able to delegate the task to someone else. For today we will leave this unchecked. We can also add a task description that will help the assignee understand what they are meant to do. 2. To add a description, in the Task Description field, type: Please review this document for approval. In the Outcomes field, we currently have two options: Approve and Reject. However, we can add more if needed. For instance, if the reviewer requires more information, we could add a “Request For Clarification” outcome that would take different actions in response. For today, we will keep the two simple options. We have five options in the Behaviour field. These options change the way an item is approved or disapproved. Let’s examine these now: • First response applies - This option will accept the first response it recieves as the ultimate response. • Majority must choose a specific outcome - This option will expect a majority of the reviewers to agree on a pre-selected outcome. If they do not reach a majority, the action will complete and any pending tasks will be set to ‘Not required’. • All must agree on a specific outcome - This option will expect all of the reviewers to agree on a pre-selected outcome. If they do not all agree, the action will complete and any pending tasks will be set to ‘Not required’. • Majority decides - This option will select the most popular outcome from the choices available. • All must agree - This option requires all reviewers to select a single outcome. If anyone disagrees, then no outcome will be reached. Today, we will stick with First response applies. We have several other options here, including what the name of the task will be, and whether to store the response in a variable to use in other locations, but we will move on today. 22 SharePoint 2010: Workflows with Nintex 1.0.0 Let’s configure the notification for this task. Configuring the Task Notification When a task is assigned, an email will automatically be sent to the assignee(s) with a link to the task and document so that they can be approved or rejected. We can customize this message. Let’s see how to do that now. 1. To move to the Task Notification panel, in the dialog box, ™ NOTE: You might have to move to the General tab for this option to appear. A dialog box appears. Here we can customize the message being sent to the assignee(s), and attach the file being reviewed along with other options. At the top we see that we can change settings for all assignees, or a smaller subset. Today we will change settings for all assignees. We can also allow delegation at this point. There is also an option that will allow user preference to determine notification. However, only email is available on the IU SharePoint server currently. We can also add a CC address or a From address. It is important to add a From address because if we do not, the email will appear to be from an unmonitored system address and it could cause confusion. Let’s add a From address now. 2. To add a From address, in the From field, type: demo30@exchange.iu.edu 3. To customize the subject, in the Subject field, type: Please Review the attached document and respond We would also like to attach the document so the user doesn’t need to log into the server.. SharePoint 2010: Workflows with Nintex 1.0.0 23 4. To attach the document, in the Attachments field, ™ the Attach file from workflow document checkbox NOTE: If you expect your documents to be large, then this is not a good option to select as it will clog up the email server. We will assume for this workflow that the documents will be fairly small (under 100kb). We will leave the default message alone for now, but we will learn some additional options for customizing the message later. Let’s examine the other buttons in the Ribbon. Understanding Flexi Task Options While we are done configuring our Flexi Task, we would like to explore the other options briefly. In the Ribbon, we see a Not Required Notification button: In this panel, we can set up a notification that will be sent if the assignee is no longer required to respond. This can happen if another reviewer has completed the task, or if a majority has agreed on a specific option. We also have a Reminders button: In this panel we can have the workflow send a reminder at a specific interval. We can also control how many reminders will be sent, and what message will be sent. Finally, we have the Escalation button: In this panel, we can make a decision about what to do in the event that no one responds to the message in a certain time period. We can choose whether to delegate the task to someone else, or simply complete the task. Once we have that decided, we can decide when to delegate or complete, and what notification to send. Now that we understand our options, we can save this configuration. 24 SharePoint 2010: Workflows with Nintex 1.0.0 1. To save the dialog, in the Ribbon, ™ Now that we have our task assigned, we need to decide what happens when a result is achieved. In this case, we will simply send a notification. Adding a Notification 1. To add a notification to the workflow, in the Workflow Actions panel, ¢ The new Workflow Action appears: to Let’s configure it now. 2. To configure the notification, in the workflow, £ The Configure Send Nofication dialog box appears. Configuring the Send Notification Workflow Action Once we have a workflow action in place, we will need to configure it in order to make sure it works properly. This is where we can alter settings for our action. We can see several options here. Items with red stars are required. The To field indicates where this particular email will be sent. This can either be an individual, or a group account, or a series of email accounts. Let’s fill that out now. We will use a demo account today. certain piece of information will need to change based on context. SharePoint 2010: Workflows with Nintex 1.0.0 25 In these cases, we can use a reference to a piece of information. References are used extensively in workflows. Let’s add one to the From field now. 1. To begin adding a reference to the To field, in the To field, ™ The Select People and Groups dialog box appears. We can search for a name from the address book, but we want to use a Lookup. 2. To open the lookup section, in the dialog box, ™ 3. To add a reference, in the Lookup category, £ Created By 4. To close the dialog box, ™ NOTE: The checkbox reading “Send individually addressed notifications” will allow you to send an email to each individual listed separately from the rest. This performs the same function as a “Blind Carbon Copy” or “Bcc:”. We can also fill in a CC: field to send the email to additional addresses. We will also need to fill in the From field. While technically it is not required, when the email is sent, the From field will automatically be filled in with a SharePoint admin account, which will not be monitored and will not route any replies to the appropriate place. Best practice for this dialog box is to always include a From address that connects to a person who can help with any questions someone might respond with. Ideally in this case, this email would come from the person that approved or rejected the document. However, depending on the setup, this could be different people, depending on how the workflow is set up, so we will need to have access to this value each time the workflow is run. 26 SharePoint 2010: Workflows with Nintex 1.0.0 1. To begin adding a reference to the From field, in the From field, ™ The Select People and Groups dialog box appears. We can search for a name from the address book, but we want to use a Lookup. 2. To open the lookup section, in the dialog box, ™ The Lookup fields appear. These are all references to pieces of data that we can use in our workflow. They are broken up into two sections: Common and Item Properties. Common are references to pieces of data that are common to the entire SharePoint site. This set of references include things like the site name, the URL of the item that was created, and the Initiator of the workflow. Item Properties includes specific data about the item that the workflow is based on. We could use the Created By field from this section as our From field, but if we do this, and a different person modifies the task, starting the workflow again, the notification will still come from the original creator. The better option here is to use the Last Task Respondant of the workflow. This will always refer to the person who activated the workflow. Also keep in mind, that the workflow will not activate when the manager modifies the workflow. 3. To add the Last Task Respondant to the From field, in the Common section, £ Last Task Respondant We see Last Task Respondant appear in the Selections field. The Last Task Respondant refers to the individual who last made a comment on the task. 4. To close the dialog box, ™ SharePoint 2010: Workflows with Nintex 1.0.0 27 We don’t have to use single items as references, we can also build entire phrases with references that we can use to fill in dialog boxes. Let’s do this to build the Subject field, which is required. This subject line should give as much information as possible, especially if this is a simple notification and requires no action from the user. 5. To begin building the Subject field with a reference, in the Subject field, ™ The Insert Reference dialog box appears: We can see a list of items and several tabs for different types of information. We can use these references to build a subject line. Before we proceed, it will be good to build a subject line that meets our requirements. Having this as a guide will make it easier to quickly build up this reference. We would like the subject to include a good amount of information. We don’t need to include things like the date and time, because the email will already have that information. We also don’t need to include the name of the person who started the workflow, as that will be included in the From field. 28 SharePoint 2010: Workflows with Nintex 1.0.0 Let’s create a subject with the following format: [Title of Item] was [Approved/Rejected] by [Last Task Respondant] Let’s build this now. The Title is located in the Item Properties tab. 6. To move to the Item Properties tab, ™ 7. To add the Title to our reference, in the Item Properties tab, £ Title We see the title field appear in the Dynamic text to insert window, underlined in red. This field is a text box that we can type in. Let’s do this now. 8. To add the next section of text, in the Dynamic text field, ™ after Title, then type: ® was ® We will have two different emails for whether the item was approved or rejected, we can simply type in the result. We are currently writing the approved email. 9. To mark the document as approved in the subject line type: Approved ® Finally, we’d like to add the final piece of our Subject field, listing who the item is assigned to. We will do this on our own. 10. Use the skills you learned in this section to add the following information: by [Last Task Respondant] 11. Once that is added, to close the dialog box and add the text, ™ SharePoint 2010: Workflows with Nintex 1.0.0 29 The text appears in the Subject field. We could use the same technique to add a detailed message body. However, a default message body with a link to the item in question will be included, so for the sake of time, we will move on today. 12. To save the settings, in the dialog box, ™ Let’s copy this workflow action to the Rejected branch, and then make some changes. Reusing Workflow Actions One of the more useful features of Nintex Workflows is the ability to copy and paste workflow actions to other locations. This allows us to quickly build branches with similar actions while making small changes. Let’s copy and paste the send notification to the rejected branch. 1. To copy the workflow action, in the workflow, ™ , ™ Copy Now we can paste it into any workflow bubble. 2. To add the workflow action, in the workflow, under the Reject branch, ™ , ™ Paste We also need to change the result from Accepted to Rejected. 3. Use the skills you’ve learned to update the Notification to Rejected and save the changes. Now we can save the entire workflow. 4. To save the workflow, in the ribbon, 30 ™ SharePoint 2010: Workflows with Nintex 1.0.0 5. To accept the save, in the ribbon, 6. To close the dialog box, ™ ™ This workflow is now complete, the final step is to publish the workflow. Publishing a Workflow Our workflow is completed, but it will not work until we have published it. There is no real test environment for Nintex workflows. Their best practice involves creating the workflow on a test site and testing it there, then saving it and loading it on the production site. This workflow is not complex enough to worry about that. But we can now publish it. Once we publish the workflow it will be active, and any item added to the list will automatically start the workflow. This will continue until we deactivate the workflow. We can update the workflow as well, but the changes will not be committed until we republish the workflow. As we have saved our workflow, you might have noticed the version number changing. It starts out as 0.1, then increments to 0.2, 0.3 etc, with every subsequent save. When we publish, it will change to version 1.0, adding a full version every time we publish. Let’s publish the workflow now. 1. To publish the workflow, in the ribbon, ™ The Publish dialog box appears. We are offered the chance to rename the workflow and change the description as well. We will simply publish today since we’ve already named this workflow. SharePoint 2010: Workflows with Nintex 1.0.0 31 2. To publish the workflow, in the dialog box, ™ The workflow will take a few moments to process. When it completes, we will see a small confirmation dialog. 3. To continue past the dialog, ™ The workflow is now activated. Let’s test it. 4. To close the workflow, in the Ribbon, ™ 5. Navigate to Shared Documents library, and add an item. Your instructor will show you the email account the workflow is attached to. And we can move on to a more complex workflow. Creating a Complex Workflow Now that we understand the basics of creating a simple workflow, let’s examine something more complex. Before we begin building a workflow, it is important that we have a clear idea of what we are attempting to accomplish. This workflow will create a simple task list based on a project description. The project description will have a project name, start date, and various roles assigned to individuals. When we add a project description, the workflow will take that information, and create tasks based on that information. These tasks will be First Draft Due, Document Review, and Final Presentation. We will use the Create Item workflow action to add each task to the the Tasks list. 32 SharePoint 2010: Workflows with Nintex 1.0.0 We will need one extra piece of information to add these tasks to the list, and that is the Due Date for each individual task. Since we can’t know this from the information that will be available in the Project Description, we will have to calculate it from the start date. We will use the Calculate Date workflow action in order to accomplish this. We will also focus on trying to build this workflow efficiently by grouping workflow actions and copying and pasting similar actions. We will set up this workflow to work automatically when a new item is added to the Project tracking list. Let’s move to the list now. 1. To view the list, in the Quick Launch, ™ Project List Let’s look at the list. It included a project title field, and a project owner field, along with a start date and a due date. This will allow us to set up a scenario where the project has a window that it can be completed in. The workflow we create will activate after we have created an item in this list. The workflow will use the values we add to the project list. We will also use this workflow to add tasks related to the project into the tasks list. This will create an all-inclusive workflow that will be very efficient. As these tasks get added to the Tasks list, our first workflow will activate, sending email to the manager about each task. Let’s get into the workflow interface now. 2. To view the workflow options, in the ribbon, ™ 3. To move to the workflow interface, in the List ribbon, ™ , ™ Create a workflow with Nintex Workflow The Nintex interface appears. Again, we will use the Blank workflow template. SharePoint 2010: Workflows with Nintex 1.0.0 33 4. To begin the workflow, with the Blank workflow template selected, ™ The Workflow interface appears. Let’s configure this workflow. 5. To configure this workflow, in the ribbon, ™ We want this workflow to activate when a new item is created, but not when modified. 6. Configure the workflow as shown below: We need to name this workflow Project Schedule, add a description, and set it to start when items are created. We do not want to allow people to start this workflow manually. 34 SharePoint 2010: Workflows with Nintex 1.0.0 7. To save the workflow settings, in the ribbon, ™ 8. To save the workflow, in the ribbon, ™ 9. To accept the save settings, in the ribbon, 10. To close the dialog box, ™ ™ Now that the workflow is saved, we can begin to build our workflow actions. Building a Workflow Efficiently We have our workflow designed, configured and saved. We are now ready to start adding actions. These actions will activate in order, so we must be careful to set them in the correct order. For this workflow, we know we want to add items to another list. We might find that other actions need to come before this one, but since Nintex is modular we can add actions at any point in the workflow. So we will begin with creating our action that will add an item to another list. We will be using the same configuration multiple times. Because of this, we will organize this in such a way that we can simply copy and paste each set of workflow actions and reconfigure them before finishing. The first thing we need to do is decide if we need any variables for this action. SharePoint 2010: Workflows with Nintex 1.0.0 35 Understanding Variables In programming terms a variable is any value that can change over time. We can use these to store and update values as needed in the workflow. They can work much like the references we encountered earlier. We will simply refer to their name and the workflow will fill in their current stored value. When we create a variable we must give it a name and a type. This type is based on the type of information that will be contained within the variable. This can be text, or numerical values, dates or even a series of items contained within one variables. For now, we will create a date variable. We also want to be sure that we aren’t duplicating any information that is already available to us. Remember that any information used in the list item will be available to us in the workflow. So let’s examine that information now. We have the following fields available: Column Project Name Start Date Due Date Project Owner Project Author Project Reviewer Project Notes Purpose This will store the name of the project. This field will store the Start Date of the project. This field will store the overall project Due Date. This will contain the username of the individual in charge of the project This will contain the username of the individual who is writing the project This will contain the username of the individual who is editing the project. This field will allow notes about the project. We will want to refer back to these columns as we’re trying to build our workflow. This is important because we will not need to store any of these values as variables in our workflow. Notice that we have a start date and due date for the entire project, but we’d like to be able to set dates for the individual tasks within the project. We will store these dates in different variables. In this workflow, we will be assigning various dates to tasks, so we need to have different date variables available to store these values. Let’s create these date variables now. We can do this through the Variables dialog box. 36 SharePoint 2010: Workflows with Nintex 1.0.0 1. To begin working with variables, in the ribbon, ™ then, ™ Here we can see the Variable dialog box. This shows us all of the variables we have currently created, and allows us to create new ones as well. Let’s create a new variable now. 2. To create a new variable, in the dialog box, ™ When we create a variable, we have to select a type. Types determine what kind of information will be stored in the variable. This can be things like a number, a string of text or a date. For now we will select the Date and Time type. Let’s name the variable and select the type. Our first variable will be for the First Draft Due Date. 3. To name the variable, in the name field type: First Draft Due Date NOTE: Variable naming in programming language usually attempts to reduce the number of characters in order to make the variable name easier to type. However, since we don’t need to type this again, we can and should make the variable name as descriptive as possible. 4. To select the type, in the Type section, ™ the Date and Time radio button We can also set a default value for this variable now, but we need the date to be in the future, so we will set it elsewhere. SharePoint 2010: Workflows with Nintex 1.0.0 37 5. To save the variable, in the dialog box, ™ The first variable is created. While we are in this dialog box, let’s create the variables for the other dates as well. 6. Use the following table to create two additional variables: Variable Name Variable Type Document Review Due Date Final Presentation Date Date and Time Date and Time Now that we have all of our variables created, we can build the workflow. 7. To close the Variable window, in the Ribbon, ™ The first thing we will need to do is calculate the date. Calculating a Date We need to build a schedule to add due dates to each of the tasks we will eventually create. The best way to do this is to use the Calculate Date workflow action. This allows us to select a date, and then add or subtract days, months or years from that date to create a new date. We will use the date the workflow is run as the base date, and calculate from there. We will calculate the date for each task individually. Let’s calculate the first date now. 1. To locate the Calculate Date action, in the Workflow Actions panel, ™ 38 then type: calculate SharePoint 2010: Workflows with Nintex 1.0.0 The Calculate Date Workflow Action appears: Let’s drag it to the workflow now. 2. To add the Calculate Date action, ¢ to the end of the workflow Now we can configure the Calculate Date action. 3. To configure the Calculate Date action, in the workflow, £ The Calculate Date configuration dialog appears. In this dialog, we need to select a date to start with, then add or subtract time to create a new date, then select the variable to store this new date in. Let’s set up the date now. Configuring the Calculate Date Action with a List Lookup We will need to set the Start Date, this is stored in the list item that activated the workflow, so we have easy access to that information. We then need to decide how far away from that date this new date will be, and then save that information in our First Draft Due date variable. Let’s do this now. 1. To set the start date, in the Date field, ™ , ™ List Lookup Now we have access to the List Lookup. This is a very powerful feature that we will explore in detail later on. When we are pulling information from the item that activated the workflow, it is fairly straightforward. SharePoint 2010: Workflows with Nintex 1.0.0 39 Currently, the Source field reads Current Item. This means, we can select any field from that list to use as the initial date. Let’s select the Start Date now. 2. To add the start date, in the Field dropdown, ™ , ™ Start Date Now, we can decide how far away from this date our First Draft will be due. We can use days, months or years in the calculation, or any combination of these denominations. We can also use hours and minutes, but we are not concerned with the time in this calculation. To add time, we use positive numbers, to subtract time, we use negative numbers. Notice that we don’t have access to weeks as a unit of time. We will have to use increments of 7 days if we want to indicate weeks. Let’s set the due date to be two weeks or 14 days away from the Start Date. 3. To push the date 14 days from the Start Date, in the Days field, type: 14 Now we just need to set the variable this date will be stored in. Since we have already created this variable, this will be easy. 4. To set the variable, in the Store date in field, ™ , ™ First Draft Due Date 5. To save this action, in the Ribbon, ™ Now let’s add a workflow action to create an item in a list. 40 SharePoint 2010: Workflows with Nintex 1.0.0 Adding and Configuring the Create Item Action Now that we have our date, we have everything we need to add and configure the Create Item action. This action will add a Task to the task list based on information stored within the item that triggered the workflow. Our first task in this project will be for the first draft. Let’s configure this now. Let’s do this now. 1. To view the Libraries and Lists category, in the Workflow Actions panel, ™ Libraries and Lists The List and Libraries category appears. We want to find the Create Item action in this list and add it to the workflow.. 2. To add the Create Item workflow action, in the Workflow Actions panel, ¢ to the bottom of the workflow The Create Item workflow action appears. Now that our item is added, let’s configure it. It will add the first task to the list. We will assume that each project will have the same task structure. However, since this is stored in SharePoint additional project tasks could be added manually. 3. To begin configuring the action, in the workflow, £ The Configure Action dialog box appears. For this type of action, we need to provide the list we want to create the item in, select a Content Type if necessary, and then select which fields will be added to the new item. Required fields are visible automatically, but we can select others with the Field drop-down. Let’s set the correct list now. SharePoint 2010: Workflows with Nintex 1.0.0 41 4. To select the list to add an item, in the Create item in field, ™ , ™ Tasks The Content type will change automatically. We could also store an Item ID that would allow us to refer back to this item later easily, but we won’t need to do that today. Let’s add the Title field. 5. To add the Title for the Task, in the Title field, type: First Draft Due Let’s add another field now. To add a new field, we select it in the Field drop down menu. When we select a new field, it will be added to the list of fields at the bottom of this dialog box. 6. To add the assigned to field, in the Field drop down, ™ , ™ Assigned to The Assigned to field appears. Let’s assign it a value. We could simply type a value in, but we would much rather attach the name of someone on the project team. We can do this by using a List Lookup. Using A List Lookup When configuring an action, we will frequently need to pull in data from other lists. When doing this, we will need to use a List Lookup. List Lookups allow us to pull in data from different lists. We could also use the Set Variable command and store a List Lookup to use later, however, this is not really necessary. Remember that while we can look up information from any list, the most common use of a List Lookup is to Let’s examine the List Lookup now. 1. To activate the List Lookup, in the Assigned to Value field, 42 ™ , ™ List Lookup SharePoint 2010: Workflows with Nintex 1.0.0 Let’s examine the List Lookup view: The Source drop-down controls which list we will pull from. Currently, it is listed as the Current Item. This is the item that activated the workflow. This can be set to any active list in the site. NOTE: If we select a different list than the current one, we will have additional options to select a conditional value to help further refine our selection. The Field dropdown gives us the option of selecting whichever field we like from the selected source. 2. To select the Project Author as the assignee, in the Field dropdown, ™ Now let’s add a start date. , ™ Project Author 3. To add a date to the item, in the Field section, ™ , ™ Due Date The Due Date field appears at the bottom of the dialog box. In this field, we can use the date we stored earlier. We first need to set the field to use Workflow Data. 4. To set the Due Date field to use Workflow Data, in the Due Date field, ™ , ™ Workflow Data Now we can select the First Draft Due Date variable. SharePoint 2010: Workflows with Nintex 1.0.0 43 5. To set the First Draft Due Date for the field, in the Due Date field ™ , ™ First Draft Due Date 6. To save the Workflow Action, in the Ribbon, ™ The Action is saved, and we can now work on our efficiency. Staying Organized With An Action Set The workflow we are designing needs to do similar tasks multiple times with slight variations. We could attempt to use a loop, but loops have big limitations in Nintex which we will see later on. Since we only need three tasks to be created we can simply duplicate the actions that set the date and add the task multiple times, then edit the configuration for those as well. We could do this one by one, but there is a more efficient way. We have a workflow action that will allow us to group items together. This is only a logical group, and does not affect the order that actions are taken. It can help in cases like these where several actions can be logically grouped in the workflow. In this case, setting the date and adding the task based on that date can be considered a single action. NOTE: It is common in programming to set variable values at the top of a program, and then use them as needed. We could do this here as well, using three Calculate Date workflow actions to set all of our dates. We are spreading them out in this workflow to make it clear how they interact with the Create Item actions. Let’s add our Action Set now. It is located in the Logic and Flow section. 1. To view the Logic and Flow section, in the Workflow Actions panel, ™ Logic and Flow 44 SharePoint 2010: Workflows with Nintex 1.0.0 2. To move the Action Set to the workflow, in the Workflow Actions panel, ¢ , to the top of the workflow NOTE: At this point, it doesn’t matter where we place the Action Set in the workflow. The Action Set appears: Notice that it has a space with a Workflow Action bubble surrounded by a box. This indicates that we can add mutliple actions underneath this action. Let’s move the Calculate Date and Create Item action to the Action set now. 3. To add the Calculate Date action to the Action set, in the Workflow, ¢ 4. Repeat step 3 with the Create Item Action. to NOTE: Remember that the Create Item action must appear below the Calculate Date action. Now that we have our Action set completed, we need to label it. Working With Comments Looking at our workflow currently, we can see that it has very generic names. For a simple workflow, this is not a huge problem, but the best practice is to clearly label each workflow action with it’s purpose so that we and other developers can easily see how this workflow is configured. Luckily, every workflow action has built-in comments that we can easily access. SharePoint 2010: Workflows with Nintex 1.0.0 45 Let’s look at a diagram of the commenting features on a workflow action: As we can see, we can name the workflow action whatever we want, and also can use labels on the left, right and bottom to add more information. We will use labels on the bottom today to allow us to maintain the name of the workflow action. We will name each workflow action today. 1. To name the Action set, in the workflow, ™ the Action Set title, then ™ the bottom Add Label note, then type: First Draft © 2. Use the following table to name the Calculate Date and Create Item actions: Current Name Calculate Date Create Item Updated Name Calculate First Draft Due Date Add First Draft Due Task Now our workflow will make more sense to other developers. Now we can duplicate this action set as a single unit, and update it as needed to add the other tasks. NOTE: Nintex does not enforce unique names on workflow actions, so be careful not to duplicate names, leading to confusion. Using Copy/Paste in Nintex The final skill we need to understand before finishing this workflow is the ability to copy and paste workflow actions. This allows us to efficiently build a workflow with similar actions. Let’s see how to copy and paste the action set we have created. 46 SharePoint 2010: Workflows with Nintex 1.0.0 1. To copy the Action set, in the Action set action, ™ , ™ Copy This will copy the entire Action Set into memory to be placed elsewhere. Let’s paste this in now. 2. To paste the Action set, in the workflow, ™ the bubble below the Action Set, ™ Paste 3. Repeat Step 2 below the Action set that we just added. The Action Set is duplicated, let’s set up the next action set. 4. Add appropriate labels to the new action sets as follows: Document Review Final Presentation 5. To update the Calculate Date action in the Document Review action set, £ We need to set this date to be further out from the First Draft date. Because of thise, we can use the First Draft Due date as the starting point. 6. To set the initial date, in the Date drop-down, ™ Workflow Data 7. To set the Variable, in the drop down, ™ First Draft Due Date SharePoint 2010: Workflows with Nintex 1.0.0 47 Now, we can set the time frame. 8. To set the distance from the First Draft Due date, in the Days field, type: 7 9. To store the variable, in the Store in field, ™ , Document Review Due Date 10. To save the action, in the Ribbon, ™ Now let’s look at the Create Item action. 11. To open the Create Item action, in the Document Review action set, £ In this view, we want to change the person responsible for the task, along with the due date. 12. Update the Task name field, the Assigned to field, and the Due Date field to be appropriate for the Document Review task. Let’s do the final task on our own. Challenge: Edit Actions to Build a Workflow In this exercise, you will duplicate the Action Set we have created, then update the comments and configuration to add additional tasks. You will complete these tasks on your own. Remember that our goal is to add a task to our Tasks list that sets the Final Presentation date as one week after the Document Review date, and has the Project Owner assigned to the task. 1. Change the comments for each of the new actions to reflect the following tasks that will be added: 48 Final Presentation SharePoint 2010: Workflows with Nintex 1.0.0 2. Update the Calculate Date and Create Item workflow Actions for each of the new Action sets. You can use your own names and date timelines. Also remember to update the Assigned to and Due Date fields in the Create item field as needed. NOTE: Consider using the previous set date as the starting date for the new actions. For instance, for the document review date, you could base it off of the First Draft due date. 3. Save and publish the workflow. Testing a Workflow Before we move on, let’s test this workflow. All we need to do to test the workflow is to add an item to the Project List. 1. Move to the Project List 2. Add an item to the Project list. Be sure to fill in the Start Date clearly. Once we have added the item, the worfklow should automatically trigger, adding the items to the workflow. Once we add the item, the workflow will automatically start, creating it’s variables and adding items to the task list in the order and configuration we specified. Let’s move to the Tasks list to see how this works. 3. Move to the Tasks list in the Quick Launch. After a moment, we should see the items appear. 4. Refresh your page if necessary. 5. Examine each task to ensure that it matches what you specified. If they don’t appear, you might have a bug in your workflow. Debugging a Workflow If we need to debug the workflow, we can see the result of the workflow in the list that triggered the workflow. 1. Move back to the Project List. When building the workflow, remember that we added a Workflow status column. We can see this in each item added. SharePoint 2010: Workflows with Nintex 1.0.0 49 2. To view the workflow result, in the list item, ™ the link in the Project Schedule column for your created item NOTE: This might read “Completed”, “In Progress”, or “Workflow Errored”. Here we can see a flowchart of how our workflow progressed, and any errors that occurred. 3. If you had an error, examine the flowchart to see where it appeared. Once we see where the workflow stopped, we have a good idea of where the problem occurs. 4. Edit the workflow to fix the error. NOTE: Remember that to edit a workflow, we must first click the list that it is attached to, and then in the List tab, click Workflows and then Manage Workflows in Nintex Workflows. 5. Publish the workflow and add another item to test. Now that we have this workflow completed, let’s move onto a site workflow. Using Site Workflows Now that we have our dropbox completed, we will want to notify the adminstrator that new documents have been added. Rather than notifying them every single time a document is added, we’d like to send a single email each day that looks for items uploaded since the last email was sent, and then informs the administrator of all of them at once. We will do this with a Site Workflow. We will schedule this workflow to activate every day. Site workflows are slightly different from the list-based workflows that we’ve been working with so far. The main difference is that we cannot count on using an existing item as the basis for the workflow. Any data we want to use we must lookup from other parts of the site. This increases the challenge a bit. But there are certain types of workflows that we cannot create at a list level. Let’s create a Site Workflow now. 50 SharePoint 2010: Workflows with Nintex 1.0.0 1. To begin creating a Site Workflow, in the menu bar, ™ , ™ Nintex Workflow 2010, then ™ Create Site Workflow We are presented with the standard workflow interface. For this workflow, we must plan carefully to ensure that we are pulling the correct information into the list. To do this, we must examine exactly what information we need. We want to see which documents have been uploaded into a document library within a specific time period, then aggregate that data into a single email to send to a pre-determined recipient. First we must decide the time period. For this workflow, we will assume a daily email. This email will be sent just after midnight, so we will want to set the workflow to look for documents that have the previous day listed. We also want to know what information the email will include for each document. Let’s assume the following information: Username of Uploader - Document Name(link) - Date Uploaded This should be enough information for our email. Let’s explore how to create this workflow. We will need several variables to complete this workflow. The main variable will be the text of the email, which we will build over time. We will also need to create a variable that will determine the previous day’s date so that we can use it as a comparison. Let’s add some variables now. Creating Variables We can add variables through the Workflow Settings dialog. Let’s open the Workflow Settings dialogue box now. SharePoint 2010: Workflows with Nintex 1.0.0 51 1. To open the Workflow Settings dialog box, in the ribbon, ™ 2. To open the Variables dialog box, in the menu bar, ™ The Variables dialog box appears. We will create several variables in this workflow, but let’s begin with our first: Yesterday’s date. 3. To begin creating a new variable, in the ribbon, ™ The New Variable dialog box appears. 4. To name the variable, in the Name field type: Yesterdays Date Since we will be storing a date in this variable, we will need to set it as the Date type. 5. To set the date, in the type field, ™ the Date and Time radio button We also have the option of allowing the user to add the value in a form field when this workflow starts. We don’t need to do that today, but it can be a valuable option in other workflows. 52 SharePoint 2010: Workflows with Nintex 1.0.0 6. To save the variable, in the dialog box, The variable is saved. ™ We will also need to create many additional variables in order to complete this project. These variables will store information that we can then coallate into a variable that will store the final output. This final output variable can then be sent in an email. We will create the rest of these variables soon. 7. To close the variable dialog box, ™ 8. In the Workflow Settings dialog box, name the workflow Dropbox Notification, and do not allow it to start manually. Now that our variable is saved, let’s create a workflow module to calculate a value. Calculating a Date For this workflow, we will need a way to compare a value to the previous day’s date. In Nintex, you can almost always select “Today’s Date”, but selecting the previous day’s date can be more complicated. We will calculate yesterday’s date at the start of our workflow, and then use it whenever we need it. We will do this with the Calculate A Date module. 1. To find the Calculate A Date module, in the Workflow Actions panel, in the search box type: calculate The Calculate Date module appears. SharePoint 2010: Workflows with Nintex 1.0.0 53 2. To move the module onto the workflow, ¢ to the workflow bubble The module is added to the workflow. Let’s configure it now. 3. To configure the date, in the workflow, £ The Calculate date dialog box appears. We start by selecting the date that we want to base the calculation on. In this case, we will use the date when the action is executed. 4. To set the initial date, in the Date field, ™ the ‘Use date when action is executed’ checkbox Now that we have our starting date, we can calculate a date based on that. We do that by either adding or subtracting years, months, days, hours or minutes from that date in order to create a new date. Our calculation today will be very simple. We will simply subtract 1 from the day field to end up with the previous day’s date. We will then store this date in the Yesterday’s Date variable we created earlier. 5. To calculate the previous day, in the Days field, type: -1 By adding a negative number, we are able to set a date in the past. We could add a positive number to calculate a date in the future. Finally, we need to tell the workflow where to store the date so that we can use it later in the workflow. We’ve already created this variable, so let’s use it now. 54 SharePoint 2010: Workflows with Nintex 1.0.0 6. To set the variable to Yesterday’s Date, in the Store date in field, ™ , ™ Yesterday’s Date 7. To complete the configuration, in Ribbon, ™ Now we can talk about collections. Understanding Collections We have learned about variables, which can store a piece of data for us that we can then use later. But we might also need to store multiple variables and work with them as a list. This will allow us to store multiple variables that are related to each other and perform identical actions on each of them with a For Each loop. For our purposes, we will put all of the information we need into several collection variables and pull information from them in order to get the final set of information that we will add to the notification. Let’s build some collection variables now. We’ll need to go through Workflow settings first. 1. To open the Workflow Settings dialog, ™ then ™ The Variables dialog box appears. Let’s create our collection variables now. We could use a single collection variable to store all of our information and then sort them using various programmatic methods. However, to simplify our view of the data, we will keep it all separate today. We will create 3 Collection variables today. One for each piece of data we want to store, and a final one to sort the data in the correct order. We want to store the name of each document uploaded, and the username of the person who created the document. We will also want to store the URL of the document uploaded, but we will build this URL using the document name that we are storing to build the URL. SharePoint 2010: Workflows with Nintex 1.0.0 55 Let’s create the collection variable for the documents uploaded now. 2. To create a variable, in the Ribbon, ™ Let’s name the variable now. We would like to be descriptive again. We would also like to give an indication that this is a collection variable. 3. To name the variable, in the Name field, type: Name of Uploaded Document - Collection In a standard programming language, this would be a terrible variable name, because we might have to continually type it, but in Nintex we can be as descriptive as possible because we will only be selecting this from a list later on. Let’s set this as a collection variable. 4. To set this as a collection variable, in the Type field, ™ the Collection radio button 5. To save the variable, in the Ribbon, ™ Now we can create the rest of the variables that we will need for the workflow. We can then discuss what each of them will be used for. 6. Let’s repeat steps 2-5 with the following information: Variable Name Username - Collection Individual Username - Person Result - Single Line Count - Number 56 Variable Type Collection Person Or Group Single Line of Text Number SharePoint 2010: Workflows with Nintex 1.0.0 Variable Name Document URL - Text Final Output - Text Variable Type Single Line of Text Single Line Of Text The Username Collection variable will store all of the usernames that uploaded documents on the previous day. We will use this list to match up to the Name of Uploaded document collection. The Individual username will store a single username each time throough the collection that we can match up to an individual document name. The Result variable will be used in the For each loop, as will the Count variable. The Document URL variable will be used to store the URL of each uploaded document that we will construct. The Final Output variable will be used to store the result of our loop. We will use this variable in the 7. To finish, ™ Now that we have a complete set of collection variables, let’s discuss how to use them. Using Collection Variables In order to use a collection variable, we must add data to it. Once the collection is populated with data there are many operations we can perform with the data. Many of these use the Collection Operation module. With this module, we can identify a collection variable, and do things like join all of the items together, or remove or add a single item. With the help of a For Each loop module, we can also perform identical actions on each of the items in the collection. But first we must add items to the collection, and also ensure that we have only the items we need in that collection. We cannot start with a For Each loop, because a For Each loop is based on the number of items in a collection variable. Without a collection variable with the correct amount of items, we cannot use a For Each loop effectively. SharePoint 2010: Workflows with Nintex 1.0.0 57 A normal loop will also be ineffective because it is difficult to program a terminating condition to end the loop in Nintex without knowing exactly how many items will need to be processed. Therefore, to populate this list, we will use a query method which will pull all of the data needed into each collection variable. Let’s see how to use this now. Populating Collection Variables With Query List Query List is a module that allows us to look up information in a list, and then store it all in a separate variable. This is great for collection variables, because it will add all of the results into the collection variable at once, and doesn’t require us to loop through a list of results. We want to query our dropbox to locate items that were created on the previous day, and also have their “Notified” column set to “No”. By using these two pieces of data, we should be able to ensure that only the documents we are interested in are added to the email. Let’s see how to use the Query List module now. 1. To locate the Query List module, in the Workflow Actions search panel, type: The Query list module appears. Query 2. To add the Query List module, ¢ to the bottom of the workflow 3. To configure the Query list module, £ The Query List dialog box appears. 58 SharePoint 2010: Workflows with Nintex 1.0.0 NOTE: We can also use Collaborative Application Markup Language (CAML) to create this query. While an experienced programmer could likely create this faster by using this language, we will use the dialog box today. We need to fill in some information in this dialog box to configure the workflow. The first thing we need to do is select which list in the site we want to query. 4. To select the list, in the List field, ™ , ™ Dropbox Now we need to set up the filter rule that will only pull items that were modified on the previous day, and that have not been previously notified. We could attempt to use the Created date as the filter, but we’ll assume that if an item has been changed we want to be notified again. 5. To open the Filter rule, in the dialog box, ™ The Filter dialog appears. By default it’s showing all items. 6. To change the filter option, ™ the Select items only when the following is true radio button 7. To select the field to check, in the filter section, ™ , ™ Modified The comparison operator is already set(is equal to), so let’s go ahead and set the value to compare to the original. We will use the Yesterday’s Date variable we have already created. 8. To set the comparison value, in the filter section, SharePoint 2010: Workflows with Nintex 1.0.0 ™ 59 9. To set the variable, in the dialog, ™ , £ Yesterdays Date 10. To finish, ™ Now we need to select the fields we want to pull out of the list items that were queried and place them into the appropriate collection variables. We can accomplish this in the Field section. To add fields, we simply select it in the field drop-down. 11. To select the first field, in the Field dropdown, ™ , ™ Name NOTE: There are several items here called Name. Select the first one listed. The Name field is the filename of the uploaded file. The Name field appears with it’s own drop down. We will add the data to the variable Name of Uploaded Document - Collection. 12. To set the variable to use, in the Name field, ™ , ™ Name of Uploaded Document - Collection Let’s add the other fields. 13. Repeat steps 11 and 12 with the following information: Field Name Created By 60 Variable Name Username - Collection SharePoint 2010: Workflows with Nintex 1.0.0 14. To complete the module configuration, in the ribbon, ™ Now we can begin to process our collection variables. Using a For Each Loop Our goal now is to combine the items in our collections into a single collection in the proper order. Once that is done we can join all of the items together into a single string that can be added to our email. This collection will also need to include things like newlines and tabs in the appropriate locations so that when we join the collection together into a string, it will be nicely formatted. This will require several collection operations, and a math operation to use as a counter to keep track of the index. More importantly, we will need to work through each collection item in order. This means that we will need to complete the same set of actions for each item in each collection. There is a special type of loop desgined for exactly this purpose called a For Each loop. This loop will take a collection, and then perform the same set of actions on each item in that loop. For our purposes, we are more interested in having the loop run a predictable number of times so that we are sure we get every uploaded document stored in our notification email. Let’s add a For Each Loop now. 1. To add the For Each loop, in the workflow actions search panel, type: For each, ¢ Let’s configure the workflow. to the bottom of the workflow 2. To configure the action, £ The For Each loop dialog box appears: SharePoint 2010: Workflows with Nintex 1.0.0 61 The information we need to provide to the For Each loop is fairly minor, and we already have our variables created, so let’s add them now. 3. Add the variables to the dialog box in the following configuration: Field Name Target Collection Store Result In Index Variable Name NameofUploadedDocument-Collection Result - Single Line Count - Number The Target collection indicates which collection will be used as a basis for the For Each loop. The loop will touch each item in this collection before completing. The Store result in field will store the current item that the loop is looking at in the collection variable. We can use this as a shortcut to pull the current item from the Name of Uploaded Document - Collection and place it in our Final Output - Text. The Index will keep track of where we are in the collection. It will begin at zero, and automatically count up one every time we get to the end of 62 SharePoint 2010: Workflows with Nintex 1.0.0 the loop. This will allow us to keep each collection variable in sync as we go through the loop, so our data stays accurate. 4. To save the options, ™ Now that we have our For Each loop created, we can discuss collection operations. Using Collection Operations Now that we have our For Each loop created, we can begin to process that data into our final form. We will use our Documents uploaded collection for a For Each loop counter to determine how many documents were uploaded on the previous day. Because each collection variable was populated together and each field was required in the Dropbox list, we can be certain that all of these collections have the same number of items. We can process these collections with the Collection Operation module. With the Collection Operation module, we can perform the following actions on a collection: • Add - this action will add a single item to a collection. Using this action, we can also add an item at a specific index value. • Remove - this action will remove a single item from a collection. • Count - this action will count the number of items in a collection • Get - this action will select an item at a specific index, and then returns that value to another variable. • Exists - this action returns a true or false value depending on whether or not an item exists in a collection. • Sort - this action will sort items in the collection, based on user parameters provided. • Pop - this action will remove an item from the end of a list, and return it to be stored in a new variable. • Join - this action will join all of the items in a collection into a single string, separated by whatever character or set of characters the user specifies. • Clear - this action will clear a specified collection. • Remove Duplicates - this will scan the collection and remove any duplicate values from the collection. For text, this is case sensitive. • Remove by value - This will search the collection for a specific variable. Using these actions, we can process these items and arrange them in order so that we can place them in the notification email in a readable format. SharePoint 2010: Workflows with Nintex 1.0.0 63 Here is the format we would like to use: 1. USERNAME NAME OF DOCUMENT UPLOADED URL We also have the option of combining the name and URL together so that we will have a clickable link, but that would require some extra work that we don’t necessarily have time for today. Let’s add the first collection operation now. 1. To find the Collection Operation module, in the Workflow Actions panel search field, type: collection The Collection Operation module appears. 2. To add the Collection operation, in the Workflow Actions panel, ¢ Let’s configure this module now. to inside the For Each action 3. To begin configuring the Collection Operation, £ The dialog box appears. At this point, we want to pull a value from the collection to store in an individual variable. Remember that each pass through the loop will refer to a single row of data. We will need a variable to store a single piece of data from the Username - Collection variable until it can be added to the Final Output - Text variable. This is because we can only do one Collection Operation at a time. So using the Get action to get a value from Username - Collection and using the Add action to add it to the Final Output - Text will have to occur in two different Collection Operations. Let’s finish up the Collection Operation now. 64 SharePoint 2010: Workflows with Nintex 1.0.0 Configuring a Collection Operation Now that we have our variable set up, we can continue to configure this workflow. Let’s examine this dialog box: Here we can see all of the options available for a Collection operation. Let’s discuss what we need to add now. • Target Collection - This is the collection that the operation will be performed on. This can be a collection that we are examining, or a collection that we are changing. • Collection Operation - This allows us to select the specific operation we will be performing, as discussed earlier. • Index - This allows us to select a variable to use as the index, which will allow us to keep each of our Collection variables lined up as we go through the process. • Store In - This gives us the ability to store the result of the operation in a new variable. This field will change depending on what action we select. 1. To configure the dialog box, fill in the values as listed in this image: In this case, the operation is being performed on the Username - Collection variable. We are performing a get operation using SharePoint 2010: Workflows with Nintex 1.0.0 65 the Count variable as an index, and we are storing this in the Individual Username variable. Now that we have the username variable set for this iteration of the loop, we can create the Document URL. We will do this by combining a reference to the site URL and the document name (stored in the Result variable). 2. To save the action, in the Ribbon, Let’s do that now. ™ Building a String In programming, it is frequently necessary to add a variable to additional text to add more information to the variable. In this section, we will be taking the name of our document and using it to create the full URL of the document, so that the person recieving the email can simply click on the URL to open the document. The only unknown aspect of that URL is the individual document name, which we have stored in the Result variable we created earlier. We can build the rest with a Build String module. Let’s add one now. 1. Search for Build String in the Workflow Actions panel, and press and drag the Build String module to the workflow below the Collection Operation. Now we can configure the module. 2. To configure the module, in the workflow, £ We see the Build String dialog box. It is dominated by a large text frame that we can fill in. Whatever we place in this box will be stored in the new string that we create. We can use references to build the string. We want to use the Site URL reference and then add the name of the folder, and the document variable. Let’s do that now. 66 SharePoint 2010: Workflows with Nintex 1.0.0 3. To begin inserting a reference, in the dialog box, ™ Here we can add references to the string to complete our URL. 4. To add the first reference, in the tabs, ™ the Common tab, £ Web URL This reference will return the actual URL of our SharePoint site. However, it won’t return the subfolder that we need access to. Let’s type it in. 5. To add the subfolder we want to point to, after the Web URL reference, type: /Dropbox/ Finally, we can add the filename, currently stored in Result. 6. To add the Result variable at the end, ™ the Workflow Variables tab, £ Result - Single Line We see: 7. To complete this reference, in the dialog box, ™ The reference appears in the text box. We now must add a variable to store this string. 8. To store the variable, in the Store In field, ™ , ™ Document URL - Text SharePoint 2010: Workflows with Nintex 1.0.0 67 9. To save the workflow module, in the Ribbon, ™ Now we can build our final output. Creating the Final Output We are now ready to build our final output. We will do this by building a string with all of our current variables. In order to turn this into a list with all of the information, we will need to build up the list over time. To do this, we will include a reference to the variable in the final string. So the first item in our string will be our Final Output variable. In programming terms, this is called recursion. Each time the loop goes through, it will take all of the information that is currently in the variable, and then add the new line. Let’s build this string now. 1. Add a Build String module to the bottom of our For Each loop action, then open the configuration dialog for the new Build String module. Now we can configure this string with references. Let’s do this now. 2. To begin, in the dialog box, ™ We will want to add the Final Output variable to the top. Challenge: Create the Final Output For this challenge exercise, you will add the material to the Final Output variable. 1. Add references and other text to create the following information: {WorkflowVariable:Final Output - Single Line} 68 SharePoint 2010: Workflows with Nintex 1.0.0 {WorkflowVariable:Individual Username - Person} <a href=”{WorkflowVariable:Document URL - Text}” >{WorkflowVariable:Result - Single Line}</a> Notice that we start by including the Final Output variable. This will ensure that each time through the loop, some additional information will be added in the correct order. 2. Store this string in the Final Output - Single Line variable. NOTE: Beginning with the Individual Uploaded variable, all of the information should be on a single line. Now that this is in place, we can craft the email that will be sent. Challenge: Send Final Notification In this exercise, you will add a Send Notification module to send the data to the final recipient. This module will need to live outside of the For Each loop, or else the email will be sent multiple times. 1. Place a Send Notification module below the For Each loop. 2. Configure the Send Notification module to send an email to demo30@ exchange.indiana.edu using the Final Output variable in the body. 3. Save and publish the workflow. Our workflow is now complete, and we can schedule it. NOTE: Some other additions we could make to our workflow include setting up a way to inform the recipient that no new documents have been uploaded. We could do this by adding a conditional which we learned about earlier that would send separate emails depending on the conditions we set. Scheduling A Site Workflow Now that we have our workflow completed, we will need to schedule the workflow so that it will run at a consistent time each day. Our workflow is counting on looking at values from the previous day, so it will need to be run after midnight. Let’s schedule this now. SharePoint 2010: Workflows with Nintex 1.0.0 69 1. To open Workflow Schedules, in the menu bar, ™ , ™ ™ The Workflow Schedules view appears. It is currently empty, but let’s add one now. 2. To add a scheduled workflow, in the Workflow Schedules view, ™ The New Workflow Schedule view appears. Our first option is which workflow to run. Keep in mind that only Site Workflows can be scheduled. The only site workflow we have is our Dropbox notification workflow. Let’s set the time. We want to set the workflow to start tomorrow, after midnight. 3. Set the Schedule Start field to use tomorrow’s date at 12:30AM. This will ensure that any documents uploaded today will be included. Now we can set the repeat options. We want this workflow to run every day. 4. To set the workflow repeat settings, in the time period, ™ 5. To set the Schedule End, , ™ Days ™ the Indefinite radio button 70 SharePoint 2010: Workflows with Nintex 1.0.0 6. To finish the schedule, in the dialog box, ™ Save Wrapping Up We’ve reached the end of these materials. At IT Training, we value your opinion very much, and want to hear your feedback about what we are doing well in these materials, or how they might be improved. If you are in our classroom, please follow your workshop instructor’s guidance and take a few moments to fill out the workshop evaluation form. Also, before leaving, please log off your computer. If you are working through these materials on your own, please take a few moments to fill out the materials’ evaluation form: http://ittraining.iu.edu/eval.aspx?Mat=EvalCode Thank you for participating in SharePoint 2010: Workflows with Nintex Contributions to These Materials Project Leader: Development Team: Andy Hunsucker Jen Oakes Tom Mason SharePoint 2010: Workflows with Nintex 1.0.0 71 72 SharePoint 2010: Workflows with Nintex 1.0.0 Where to Go From Here You can use the resources listed below to further build your computing skills. Taking Other IT Training Workshops UITS IT Training offers hands-on instructor-led computing workshops aimed at a variety of skill levels, covering a broad range of topics. We teach hundreds of workshops on more than 80 topics every year! For more information, to see a detailed workshop schedule, or to register for a workshop, contact IT Training: Web: http://ittraining.iu.edu/ Email: (IUB) ittraining@indiana.edu; (IUPUI) ittraining@iupui.edu Phone: (IUB) 812/855-7383; (IUPUI) 317/274-7383 Getting Help from Online Resources University Information Technology Services – IU technology resources, services and support: http://uits.iu.edu/ IT Training Online – Self-paced IT courses you can take on your computer: http://ittraining.iu.edu/online/ UITS Knowledge Base – Searchable database of computing questions: http://kb.iu.edu/ IT Training Tips – Comment-enabled blog with training articles and videos: http://ittrainingtips.iu.edu/ Getting Help from Support Staff Walk-in Support (All IU Campuses) Walk-in Support Center. Locations and schedules at: http://kb.iu.edu/data/abxl.html (IUB & IUPUI) Consultants in the UITS Student Technology Centers 24 Hour Phone Support (IUB) 812/855-6789 E-mail Support (All IU campuses) ithelp@iu.edu (IUPUI) 317/274-4357