Académique Documents
Professionnel Documents
Culture Documents
with Nintex
2013
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/
Contents
Welcome and Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Calculating a Date . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
Getting Started
These materials presume you will begin work from the desktop, and have any
required exercise files located in an epclass folder there.
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/
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. Its written by
training and support providers from across the entire IU system; you may
read and comment on these at:
http://ittrainingtips.iu.edu/
Todays Project
In todays 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.
Lets 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.
Lets 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, lets see how they are
created.
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 doesnt 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.
Lets begin by creating a list.
http://www.sharepoint.iu.edu/sites/umwadv/
NOTE: In todays 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.
Lets create a site.
3. To begin creating any object, in the SharePoint Ribbon,
We have a template created that has our columns created. Lets select it
now.
4. To select our site template, in the dialog box,
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:
usernames site
username
The username you will use today is located in the upper right corner of
the screen.
7. To create the site,
Before we continue, we have to make sure that Nintex is turned on for this
site.
, Site Settings
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,
Now that Nintex is turned on for our site, we can begin working. Lets
look at our Quick Launch.
We have a few lists already created here. Well 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.
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. Well use the blank template today.
3. To begin the workflow,
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. Well 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
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. Lets 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.
Lets open the Workflow Settings dialog box now.
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.
Lets start with a title for our workflow. This workflow will send a
notification for items added to our list, so lets name it after that function.
2. To add a title, in the Title field, type:
This workflow will add a task to review the document and send a
notification when uploaded.
Now lets look at some of the more advanced configuration options.
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 lets see how to set up the workflow to begin when an item is
modified.
16
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 dont 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.
Lets 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. Lets add the jump061 account
name we used earlier.
5. To add the value to compare, in the blank text box, type:
demo30,
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
Here we will configure the Flexitask to assign the task to the correct
approver and what outcomes are possible.
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:
22
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.
Lets add a From address now.
2. To add a From address, in the From field, type:
demo30@exchange.iu.edu
We would also like to attach the document so the user doesnt need to log
into the server..
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. Lets examine the
other buttons in the Ribbon.
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
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,
to
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,
Created By
26
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,
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,
We dont have to use single items as references, we can also build entire
phrases with references that we can use to fill in dialog boxes. Lets 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,
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
dont need to include things like the date and time, because the email will
already have that information. We also dont need to include the name of
the person who started the workflow, as that will be included in the From
field.
28
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. Lets do this
now.
8. To add the next section of text, in the Dynamic text field,
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, wed 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:
11. Once that is added, to close the dialog box and add the text,
Lets copy this workflow action to the Rejected branch, and then make
some changes.
, Copy
2. To add the workflow action, in the workflow, under the Reject branch,
, Paste
30
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.
Lets 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 weve already named this workflow.
32
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 cant 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.
Lets move to the list now.
1. To view the list, in the Quick Launch,
Project List
Lets 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.
Lets get into the workflow interface now.
2. To view the workflow options, in the ribbon,
The Nintex interface appears. Again, we will use the Blank workflow
template.
We want this workflow to activate when a new item is created, but not
when modified.
6. Configure the workflow as shown below:
34
Now that the workflow is saved, we can begin to build our workflow
actions.
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 arent 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 lets 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 were 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 wed
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.
Lets create these date variables now. We can do this through the Variables
dialog box.
36
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.
Lets create a new variable now.
2. To create a new variable, in the dialog box,
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.
The first variable is created. While we are in this dialog box, lets create
the variables for the other dates as well.
6. Use the following table to create two additional variables:
Variable Name
Variable Type
Now that we have all of our variables created, we can build the workflow.
7. To close the Variable window, in the Ribbon,
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. Lets calculate the first
date now.
1. To locate the Calculate Date action, in the Workflow Actions panel,
38
, 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.
Currently, the Source field reads Current Item. This means, we can select
any field from that list to use as the initial date.
Lets 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 dont have access to weeks as a unit of time. We
will have to use increments of 7 days if we want to indicate weeks.
Lets 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,
40
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,
Now that our item is added, lets 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,
, Tasks
We could also store an Item ID that would allow us to refer back to this
item later easily, but we wont need to do that today.
Lets add the Title field.
5. To add the Title for the Task, in the Title field, type:
Lets 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
42
, List Lookup
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,
, Project Author
, 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
5. To set the First Draft Due Date for the field, in the Due Date field
44
2. To move the Action Set to the workflow, in the Workflow Actions panel,
NOTE: At this point, it doesnt matter where we place the Action Set in the
workflow.
The Action Set appears:
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.
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,
2. Use the following table to name the Calculate Date and Create Item
actions:
Current Name
Calculate Date
Create Item
Updated Name
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.
46
, Copy
This will copy the entire Action Set into memory to be placed elsewhere.
Lets paste this in now.
2. To paste the Action set, in the workflow,
The Action Set is duplicated, lets 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
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.
Lets do the final task on our own.
48
Final Presentation
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, lets 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 its
variables and adding items to the task list in the order and configuration
we specified.
Lets 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 dont 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.
the link in the Project Schedule column for your created item
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, lets move onto a site
workflow.
50
, Nintex Workflow
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.
Lets assume the following information:
Username of Uploader - Document Name(link) - Date
Uploaded
This should be enough information for our email. Lets 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
days date so that we can use it as a comparison.
Lets add some variables now.
Creating Variables
We can add variables through the Workflow Settings dialog. Lets open the
Workflow Settings dialogue box now.
We will create several variables in this workflow, but lets begin with our
first: Yesterdays date.
3. To begin creating a new variable, in the ribbon,
Yesterdays Date
We also have the option of allowing the user to add the value in a form
field when this workflow starts. We dont need to do that today, but it can
be a valuable option in other workflows.
52
Calculating a Date
For this workflow, we will need a way to compare a value to the previous days
date. In Nintex, you can almost always select Todays Date, but selecting the
previous days date can be more complicated.
We will calculate yesterdays 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 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,
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 days date. We will then store
this date in the Yesterdays Date variable we created earlier.
5. To calculate the previous day, in the Days field, type:
-1
54
, Yesterdays Date
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.
Lets build some collection variables now. Well need to go through Workflow
settings first.
1. To open the Workflow Settings dialog,
then
The Variables dialog box appears. Lets 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.
Lets create the collection variable for the documents uploaded now.
2. To create a 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. Lets 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
Variable Name
Variable Type
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, lets discuss how
to use them.
Query
58
, 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 well 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 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 lets go ahead and
set the value to compare to the original. We will use the Yesterdays Date
variable we have already created.
8. To set the comparison value, in the filter section,
, 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 its 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,
Field Name
Created By
60
Variable Name
Username - Collection
For each,
The information we need to provide to the For Each loop is fairly minor,
and we already have our variables created, so lets 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
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.
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
dont necessarily have time for today.
Lets add the first collection operation now.
1. To find the Collection Operation module, in the Workflow Actions panel
search field, type:
collection
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.
Lets finish up the Collection Operation now.
64
Here we can see all of the options available for a Collection operation. Lets
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:
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.
Lets 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.
Lets do that now.
66
This reference will return the actual URL of our SharePoint site.
However, it wont return the subfolder that we need access to. Lets type
it in.
5. To add the subfolder we want to point to, after the Web URL reference,
type:
/Dropbox/
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,
68
The Workflow Schedules view appears. It is currently empty, but lets add
one now.
2. To add a scheduled workflow, in the Workflow Schedules view,
, Days
Save
Wrapping Up
Weve 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 instructors 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
Andy Hunsucker
Jen Oakes
Tom Mason
72
(IUB) 812/855-6789
(IUPUI) 317/274-4357