Create a Powerful SharePoint Designer Workflow Part 1

Create a Powerful SharePoint Designer Workflow ­ Part 1 In this demo, I am going to show you how you can use the capability of  Workflow   Designer,  ...
Author: Lorin Oliver
0 downloads 3 Views 143KB Size
Create a Powerful SharePoint Designer Workflow ­ Part 1 In this demo, I am going to show you how you can use the capability of  Workflow   Designer,   which   comes   as   part   of   SharePoint   Designer   to  create some really powerful Workflows.  Now, all the stuff I am about  to show you right now, you can do that with Window SharePoint Services  and just one copy of SharePoint Designer.  Now, I am going to be using  this Human Resources Site for my demo.   So, the scenario here being  that anybody who gets employed by this company must come to this site  and   first   go   through   the   Resource   Provisioning   document   library   and  fill out a form in this document library.   Now, this form has to be  filled out because each person who comes in to this organization will  have   to   be   issued   some   equipment,   so   equipment   such   as   a   Laptop,   a  Desktop, a Cell Phone, a Windows Mobile Device and a Procedures Manual  depending on  the person,  which  department they  are joining.    So, if  they are joining the Sales department, or they are joining IT, or they  are   joining   HR,   they   will   be   getting   different   types   of   equipment.  And what I want to do is when they fill out this form, first make sure  that their information that they are providing me is correct, so they  belong to the department that they are telling me that they belong to.  So, I want to verify with the Department Head if the information is  correct.  The Department Heads are right here in this Department Heads  list.  Sales, HR and IT, each of them have a different Department Head  and their Email is listed here as well, so I want to clarify and make  sure,   confirm   with   them   that   this   person   does   belong   to   their  department.  And also, once and if that person does belong, I want to  send an Email to the Resource Manager for that department to let them  go ahead and issue the equipment that this person needs.  And when the  equipment is issued for a person, the Equipment Issued list, which is  right here is going to get filled up with their First Name, their Last  Name and the Equipment that they were issued.   And of course, I want  all this stuff to happen automatically ­ the Tasks should be assigned,  the Equipment Issued should happen automatically and the list should  get   populated   automatically,   and   of   course,   the   ‘automatically’  happens through designing a Workflow.   So, let us  first  look at  this form, the Resource  Provisioning Form.  Now, the design of this form, which is actually an InfoPath form is  not in context of this demonstration.  There is a separate screencast,  a separate video tutorial for that of how this form can be created and  attached to this library.   But, let me go ahead and quickly show you  the form.   So, when I click on New, it should bring up the InfoPath  form.   Here we go.   In the browser, using forms server, so it is a  Resource   Provisioning   Form   for   Adventure   Works   bicycle,   which   is   a 

fictional Corporation.   The person puts their First Name, Last Name,  the   First   Name   here   being   a   mandatory   field,   as   you   can   see   with   a  asterisk, the Date is filled in automatically, the Date of Hire they  have to fill in and the Date of Hire can only be today or something  earlier than today.  If this Date is after today’s date, then it will  verify, it will stop them actually from filling out the rest of the  form because the Date of Hire has to be today or earlier than today.  If they are being hired later than today, then they cannot fill out  this   form   yet.     Then   they   provide   Email   address   of   the   person,   of  themselves, and then they fill in the Department that they belong to.  And this Department section here and the Department Head textbox here  is already connected to the SharePoint list that I showed you earlier,  the Department Heads SharePoint list.   So, if I click on Sales, for  example, it shows me the Department Head for Sales is Brandon Olson.  And you can’t go in there and change something.   So, it is all read­ only.     Same   thing   for   IT,   Greg   Lloyd,   and   HR   is   Marty   Hester.  Alright,   so   that   is   all   that   is   there   to   do.     It   is   a   very   simple  form.   They fill this out, they submit it and then the magic should  start   happening.     The   Workflow   should   get   kicked   off   and   everything  should happen.   So, let us navigate back to the site.  I am going to click on the Back  button here and here is my site.  So, the first thing I need to do is  pull up this site in SharePoint Designer.  Once I pull up this site, I  need to attach my Workflow, the new Workflow that I will be creating,  I need to attach it to the Resource Provisioning library and then go  from there.   So, let us get started.   Okay, so let me go ahead and  open up SharePoint Designer.  Start  All Programs  Microsoft Office    and  Office SharePoint  Designer right  here.    And  let  me also  take  the   URL   of   the   site,   and   copy   to   the   Clipboard.     Now,   SharePoint  Designer opens up.  The first thing I need to do is open up that site.  So, File    Open Site,  put  in  the  URL.    Always  be  sure  to  take  out  this other stuff that we don’t need, the Forms/AllItems.aspx etc.  You  want to end up the URL with the actual site’s name which is not even  this,   it   is   actually   HR.     Okay,   so   Site   Directory/HR   for   Human  Resources.  Click on Open, authenticate as myself, Asif.  Alright, the  site   opens   up.     Next   thing   I   need   to   do   is   go   to   File    New   Workflow.     At   this   point   in   time,   the   Workflow   Designer   starts   up.  And before it even starts up, SharePoint Designer goes out and fetches  all the different Lists and Libraries that  are present  on this  site  because I can attach my Workflow to any of those Lists or Libraries.  So, it needs to have a list of those Lists and Libraries first, which  is right here.  I can attach to any of these Lists or Libraries.  What  I want attach to is the Resource Provisioning library, and I want to 

name this Workflow ‘Provision Resources’.   Okay, so that is my name,  Provision   Resources,   it   is   attached   to   the   Resource   Provisioning  library, maybe the naming could be better, but, that is okay for right  now.   And also I want to say that start this Workflow when I want it  to, I can start it manually or start it when a new item is created in  the library.  Alright.   Let us go through the next step.   Now, in this main window, you can  create as many Workflow steps as you wanted to.  So, it gives you the  step for the first step, Step 1.  In each step that you create, within  that step, you  can have as many conditioned ______  (07:10), you can  also have subsequent Actions for that if that condition is true, you  can   build   those.     And   also   you   can   have   a   ‘Else   If’   kind   of  conditional   branching,   so   if   the   first   condition   is   not   true,   then  move on to the next condition, evaluate that, if that is not true, you  can have more conditions that you want.   So, for this first step, it  is going to be a pretty simple step.   I am going to name this first  step ‘Create Full Name Variable’.  What I mean to do here is the form  that they are filling out, that the employees are filling out, has a  First Name field and a Last Name field, what I want to do is combine  both   of   those   fields   and   make   it   into   a   variable,   a   Full   Name  Variable, which I can use throughout the Workflow or later if I needed  to do.   So,   I   am   going   to   click   on   Actions,   there   is   no   condition   for   this  step.  This Action, this step is always going to happen, so I will go  directly to Actions.  And I want to choose the ‘Build Dynamic String’  Action.     Alright,   so   ‘Store   Dynamic   String’,   I   will   click   on   the  ‘Dynamic   String’   part,   and   build   my   string   here.   I   can   put   static  values   here,   or   I   can   put   some   dynamic   values   here,   which   could   be  lookups.  It is exactly what I intend to do now.  Click on Add Lookup.  Now, the current item always signifies the Current Item, the current  form in the Resource Provisioning library they were attached to.  So,  in that current item, what I want to do is look for First Name, which  is right here.  So, First Name field and then put a space by clicking  on the space bar and do another lookup for the Last Name.  Here we go.  So, now this variable is going to return back First Name space Last  Name.  Let us click on OK.  Variable, I will name it a new variable so  I can remember easily.  Click on ‘variable’, create a new variable, so  it is already going to be of Type ‘String’ because it is building a  string   for   me.     The   variable   Name   here   is   going   to   be   Full   Name.  Okay, and that is my first step.   The next step in this process is going to be to confirm the department  affiliation for this user.  So, if this person says that I am joining 

or   I   am   in   the   IT   department;   is   this   person   really   in   the   IT  department?   I need to confirm that with the Department Head.   So, I  will click on Add Workflow Step, and let us name this step ‘Confirm  Department   Affiliation’.     Now,   this   is   also   going   to   be   an   Action  straight, there is no condition for this one.   Click on Actions and  what I want to do is I want to collect data from the user.  I want to  assign a Task to a user, in this case being the Department Head for  their   Department,   and   I   want   to   ask   this   person   ‘Does   this   person  really exist, or is going to become a part of your department or not?’  so, this is going to become a task in the Tasks list assigned to this  person.     Alright.     Collect   Data   from   a   User,   the   data   I   want   to  collect, just click on data, it is going to be a Task, let us look for  the name of the task, I will type in ‘Confirm Department Affiliation’    and Next.   Okay, so then I want to, I do have the option here, I  don’t   have   to   but   I   have   the   option   to   create   fields,   to   create  columns   in   this   particular   Task   list.     For   the   new   Task   that   I   am  assigning, I can ask for additional data.   So, I can ask a question  within the Task.   And I want to do that, I want to add a new field  here, and the field is going to be ‘Is this user in your department?’  The answers I am looking for is just going to be a Choice answer.  And  it   is   just   going   to   be   ‘Yes’   or   ‘No’.     So,   as   it   says,   enter   each  choice on a separate line.  And it is going to be drop down list.  So,  when this Department Head gets a Task, it is just going to be an item  in there, a column in there.   So, this is going to say ‘Is this user  in your department?’   And they just have to select ‘Yes’ or ‘No’ for  the answer.  Simple as that.  Okay, so I create the Task.   Now I want to create it for the Department Head that this person has,  that the employee has filled in to be their department.  So, I want to  look it up from that form that the person filled out.  I will click on  ‘this user’.   So, since I don’t know exactly which user it is, which  Department   Head   it   is,   I   need   to   do   a   Workflow   Lookup,   to   Add   and  Lookup   I  am   doing   right   now   is   on   the   Department   Heads   list,   and   I  need  to look  for  the  person’s  Email.   So,  that  is  going to  be  Head  Email, that is what I called the field.  Okay, so I am looking in the  Department   Heads   list,   and   I   am   looking   for   the   Head   Email   field.  Now,  I need to  do  a match  up  here  so  this  task  knows  exactly  which  Department   Head   to   query.     So   the   field   that   I   am   looking   for   is  Department Head, okay, so I want to match up the Department Head field  in   the   Department’s   Heads   list,   with   the   Department   Head   that   this  person who is filling up the form has picked in their form.  Alright,  I   will   click   on   the  fx  button   here,   I   will   say,   yes,   current   item,  which is the form, and let us look at, there you go, the Department  Head.   Now, this is a little difficult for people to understand the 

first time they are looking at it, but what is happening here one more  time is, I am looking at the Departments Head’s list and I am looking  for the Department Heads email and I am looking for the record in this  list,   which   matches   up   the   Department   Head   that   was   picked   by   this  person while filling out the form.   So, let us look at this list in  SharePoint one more time, the Department Head list, maybe this will be  better to explain.   In   Department   Heads   list,   if   the   person   filled   out   HR,   that   they  belonged to HR, Marty Hester to be returned; if they say they belonged  to IT, then I need Greg Lloyd’s email to be returned.  So I am doing a  match   on   Greg   Lloyd,   this   field   right   here,   Department   Head   field,  with the field that they filled out in the InfoPath form.   Okay, coming back here to SharePoint designer, once I have done this  matchup, and I am getting the person’s email, the head email, I will  click   on   OK,   it   is   telling   me   right   now   that,   you   know,   ‘It   is  possible that this might return more than one value, is that OK?’  And  this is a chance that I have to take, and I need to be sure that each  department has one head and you know a department is not listed twice  in the list.  If it is listed twice, then I need to go ahead and fix  that list.   So, I will take chance and say ‘Yes, that is fine, if it  returns multiple values, it is my fault’.   Then I will click on OK.  Alright,   so   now,   it   is   getting   data,   the   task   data,   from   that  Department Head.   And what I want to do is I want to be able to see  that record, point to that record I should say, later in the Workflow.  So, what I want to do is I want to get a pointer to this task and here  is  how  I  do that.    Click  on Variable,  create  a new  variable,  and  I  will just call this ‘Confirm Department ID’.  So, one more time, what  is happening here is that, of course this Workflow is going to get run  several times for different forms that people are going to fill out,  and each time this task is going to get assigned to different people,  to Department Heads, what I want to do is, when this task is out there  and the person is filling out this task, I want to keep a pointer to  this task, which is going to be in the ‘Confirm Department ID’ field,  and I want to refer to the result of this task of what the person said  that the user does belong or does not belong to their department.   I  want to have that result to be used later in my Workflow.  So, that is  what   the   variable   ‘Confirm   Department   ID’   does.     It   provides   me   a  pointer to this specific task. 

Suggest Documents