Active Directory User Details Update application
This tutorial explains how to build an application that can be used to display and update details from Active Directory. Your organization may have a need to allow users to list information from Active Directory, and keep Active Directory updated by allowing users to update outdated information which can then be saved back to Active Directory.
This tutorial will explain how to create a SmartObject that interacts with an external system (Active Directory, in this case) and then use that SmartObject in views and forms. You will also learn how to build a workflow that will interact with Active Directory using the build-in AD wizards available in the K2 workflow designer..
Application Overview
Prior to jumping into building your application, it’s important to perform some preliminary design to decide exactly what you need your application to accomplish. You begin by creating a flowchart of the complete process and determine what tasks need to take place and who (or what) will be performing them. Remember that you can think of K2 application in terms of Data, Forms, Workflow and Reports. When an application has a workflow component to it, it is usually best to approach the design starting with the workflow, then the forms, then the reports and finally the data.
Workflow Design
The flowchart below represents the logical behavior of the workflow in your application. There are two swim-lanes for user tasks. The first is the Form Originator, or the person submitting the form for the first time. The second swim-lane represents the Approver lane, in your case this will be the Active Directory account owner. The third lane represents System Tasks, or tasks that K2 will manage behind-the-scenes. Notice that along the way, the workflow may move from one lane to another lane. K2 seamlessly interacts with both human and system components.
In this application a user will update the details for a user in Active Directory and start the workflow. The workflow will check if the updated details are for the originator of the workflow (in other words, someone updated their own details) and if this is the case, immediately update Active Directory with the new information. If the user updated another person's details, the workflow will assign a task to that person to review and accept the changes before the workflow will update Active Directory.
Forms design
You will use two different forms for your application.
The first form will be used to list AD Users and update a specific user's details. See the image below for an example of this form. In this case, the user selected Anthony Petro from the list of users, and Anthony's details were inserted into the AD User Detail view. The user can then modify any of Anthony’s telephone numbers and click the Update User Account button. That action will initiate the workflow.
The form used to display and update a user's details
The second form will be used if the Approval Task is required. In this case, the other user can open this form to review the updated information, and then make a decision on whether they accept the changes or not.
The form used to review and accept (or not) the updated details
Data Design
In this application, all the data required resides in Active Directory. To expose this data to your application, you will need to create a SmartObject. This SmartObject will have two methods: one method will return a list of users from active directory, and another method will return a single user's details from Active Directory.
There is a slight complication, however. Suppose that you change another person's information. You cannot commit that new data to Active Directory because the other person has not reviewed and accepted your changes yet, so you need some way to temporarily store the updated values until the other person has accepted the changes.
While you certainly could create a K2 SmartBox SmartObject to store data, for this application the data is really only relevant while the workflow is running, so you will instead define separate data fields in the workflow to store the updated telephone numbers. If the other user accepts the changes, the workflow will then use these temporary values to update Active Directory.
Building the application
Now that you have designs for each of the elements of the AD User Details Update application, you can start building them. As before, you will start with the data elements, then do the views and forms elements, followed by the workflow. Finally, you will test the application.
When you are ready to start building the application, continue on to the Part 1: Data section to get started.