Wednesday 18 June 2014

K2 Blackpearl Document Approval workflow


Create a document library in sharepoint add new Custom column nem it: Approval Status
It should be choice: In Review, Approved, Rejected are values
Open K2 studio
Create new project. Type: K2 Project.
Add new process select blank template. Name it:

From process helper from Solution
Drag “Start when new item created” on start
Select SharePoint site and list

Click on Solution explorer
*Click on Process wizards
Select "Sharepoint Workflow integration" wizard.
Drag and drop in the canvas after start activity.
You will get wizard, click Next
Select "A SharePoint List or Document library" option
Enter SharePoint Site URL, By clicking on ...
You can test it, by clicking on Test
Click on Browse
Select Document Library
Form Technology: ASP.NET
Click Next
You can change the name of workflow
You can change the Task list and workflow history list, but i am going to leave it now
Click Next
Now you can map meta data
I am leaving as it is ..
Click Next
Here you can set folio.
folio is like a uniqu id, to identify the task
I am going to add folio by clickong on ... button
you will get Context Browser
Click on 3rd option
Click on XML Fields
Click on <Project Name>Process
Expand Metadata-->items-->Item-->
Select Title
By CLick on Add you can map Input fields with SHarePoint columns..right now i am not going to map anything..
Click Next
Finish
The above wizard you can edit , by clicking on "Process" Option the k2 studio-->Under INtegration, you can find SharePoint Wizard
* Now i am going to add event wizard
In the Solution explorer -->Click on event wizards
Select "Sharepoint Workflow integration Client" event (This is Client event: Client event will required some manual interaction..)
(Server Events: will fire automatically when workflow reaches to that stage..)
Drag and drop "Sharepoint Workflow integration"
Here we will configure SharePoint Task form, to access the Task inorder to approve reject the task.
Click Next
Event Name: Manager approval
SharePoint Task Title: Manager Approval
Click Next
Select Default Send Notification Option
Next
Add Approved, Rejected OutComes
Select Check box to generate outcome lines..
Click Next
Add Destination users
Click Add
Click on ... button
Context browser will open
From User option(2nd option in Context browser) select any user
But now i am going click on Workflow contex browser(4th option in Context browser), expand process instance
Click on Orginator, expand +
Select Manager
Click Add
Click Next. Finish
You will get new activity in the Canvas..
I am going to rename it: Document Approval
You can see outcomes also
I am going to draw line form start activity to Document Approval activity
Now when manager approve or reject the document i am going to update the status of the document library in "Approval Status" column
Now i am going to drag and drop "SharePoint Documents" Event
You can see option what we can do using "SharePoint Documents" in the wizard...K2 Welcome screen
We can upload and Download documents
Check in, Check Out and undo Check Out
Move, copy and delete documents
Retrive and update document information..
Click Next
Change Event Name
Click on Update Documents Metadata
Expand
Select from Content field
Click Next
Click on ... button
Context browser will open
Click on process Activity data (3rd option)
Expand xml fileds..
<Project name>process
You can find: WFProcessfields
Select WFProcessfields
Click Add
Next
It will ask enter design time values like.. document library name
Next
Now you can find Document Library Columns
Check Approval Status and Click on Assign
Select Approved
Finish
Rename the activity name:Approved
Drow the line
Copy and paste the Approved Activity
rename as Rejected
run the wizard
Change the Approval Status: Rejected
Draw the line to rejected activity
Now i am going to add Email event to complete the process
Select Email Event and drag and drop Approved and Reject Activity
Email Event should after Approval status has updated
Fill Email Event data
You can define the Email body with dynamic values
Save the workflow and Deploy the workflow
Open Document library
Add New document
Open Manager Email or k2 Worklist or Task List
Click in your new task from Task List
it will open a form with approved and rejected option
Click Submit
you can see status has changed and you will get email also..