Friday, January 16, 2009

An approach towards implementing information entry forms using Silverlight and SharePoint

 

An approach towards implementing information entry forms using Silverlight and SharePoint

Introduction

Enterprises are regularly challenged with implementing custom user interfaces for capturing all sorts of internal information. Technically this could be achieved by creating custom ASP.NET web pages and recording the information in a Line of Business database. In this article , I have envisioned a solution which marries the RIA capabilities of SL and the portal/document management features of Windows SharePoint Services 3.0 (or even MOSS since it is built on WSS 30). Silverlight 2.0 is a powerful tool for building Rich Internet Applications. Silverlight comprises of a client side runtime which is hosted as an ActiveX control when using IE. The runtime downloads the specified .XAP file (ZIP) containing .NET assemblies and executes the compiled instructions within the assemblies.  SharePoint on the other hand provides an infrastructure for creating dynamic web pages which could be edited in-place or composed out of web parts. The outcome of this union offers a powerful solution to accomplish the following:

  1. Developing user interfaces using Silverlight for the purpose of information entry
  2. Storing the form templates (XAP files) in a document library for re-use across the enterprise
  3. Designing a re-usable SharePoint Web Part which would be responsible for rendering the XAP file at runtime
  4. Submitting user information to a custom document library and initiating a workflow to further process the submitted information
  5. Make this process easily repeatable without the business owner ever having to physically touch the application servers (servers running the WSS web front ends). Think of an organization with over 5000 employees. We do not want the business user(s)  running to a the IT administrator asking them for physical access to the web servers. We want the solution to be as close as possible to 'Software as a Service' paradigm.

Scenario:Expense Report Submission

image

This is an example of a very typical Expense data entry form. The steps for this scenario are as follows:

High level solution

  1. The employee would browse to an Intranet self service portal and select Business Expense Form. This would open up a data entry page.
  2. Employee would fill in the relevant details by adding line items for each business expense.
  3. Upon submission the the data will be saved centrally and a long running workflow process will kick off.
  4. The workflow will send out an email notification to an approver (employee manager in this case).
  5. If approved, the expense data would then be added into the line of business accounting system. The employee would be intimated through email.
  6. If not approved, then the approver would type out a reason and the employee would be notified through an email.

Overview of the solution

  • Create a reusable Web part which could be configure with the path of a XAP file and would render the XAP file during run time. Call this web part as Generic Silverlight Web Part.
  • Create a new Silverlight Application, name it as ExpenseTemplate.  Create a class library which would contain the data model representing the attributes of the Expense information.  E.g. In this scenario, the classes are shown in the class design below
  • Class diagram of the data model
  • Create a new WSS document library , name it as XapLib. This document library could be re-used for hosting several business forms.
  • Upload the .XAP file to XapLib document library

image

image

  • Create a new  WSS page based on the Web Part template page. To this page add an instance of the Generic Silverlight web part.
  • Configure the Generic Web part in design mode of the page with the relative path of the ExpenseTemplate XAP file
  • Configure the Width and Height of the Web Part so as to make the Silverlight application utilize the available real estate without any of it's borders getting clipped.

image

image

  • The final page would appear as follows:

image

  • Create a document library which will be used for submitting the data entered by the user in ExpenseTemplate form
  • In the click event handler of the 'Submit data to server' the Silverlight form will serialize the object model and save the XML data to the configured List.

Technorati Tags: sharepoint,silverlight,software as a service

Conclusion

  1. Storing SL apps in a WSS document library offers a very compelling solution towards distributing Silverlight applications. This makes it possible for ordinary programmers to proliferate their organization with SL apps without bothering about physical deployment to the file system of the web servers.
  2. By using WSS/MOSS for building customizable web part pages, we have made it easy for the programmer to rapidly design and deploy data capture forms.
  3. There are still a few questions to be answered:
  4. After submission of the data to the destination Document library, the workflow will process the XML data. How is the XML data processed in the subsequent steps of the workflow?
  5. What sort of UI do we employ for letting the approver view the XML data in a business friendly way?
  6. I would be addressing these questions in another article which I will be posting shortly on this blog.

Disclaimer

The ideas presented in this article are solely those of the author and may not represent Microsoft Corporation.

Posted: Thursday, January 15, 2009 9:33 PM by Saurabh Dasgupta

saurabhd's musings : An approach towards implementing information entry forms using Silverlight and SharePoint

No comments:

Blog Archive