Workflow - ProcessManager - WebPart - Developer Guide - Simple

Published on Tuesday, 11 July 2017

In this Article I'm going to explain how to create a simple WebPart and display some data on the Process Page inkeeping with the PM theme.

Articles


If you open the 'Symantec™ Workflow 8.1 Component Developer Guide' (https://support.symantec.com/en_US/article.DOC9626.html) and navigate to

  • Chapter 9
    • Extending Workflow Process Manager .................................... 190
      • About writing webparts for Process Manager ............... 198
      • Writing webparts for Process Manager ......................... 198

Unfortunately there are only a couple of pages on how to create a Webpart.


About writing webparts for Process Manager

Process Manager is an ASP.NET 4.0 compliant portal (ASP.NET webpart host). You can host any ASP.NET 4.0 webparts in it.

Webparts are part of the ASP.NET 4.0 specification. Process Manager hosts basic ASP.NET 4.0 webparts.

If you are unfamiliar with ASP.NET webparts, you can find help in an abundance of online articles. We recommend familiarizing yourself before attempting to build ASP.NET 4.0 webparts. Because Process Manager is a compliant webpart host, nothing special has to be specified to build controls that will reside in Process Manager.

Process Manager has an integrated catalog mechanism, so, when you have finished building your webpart, you can load it into the Process Manager using the integrated plugin loading mechanism, then register it with the webpart catalog.

See “Uploading a plugin into Process Manager” on page 197.

Writing webparts for Process Manager

Creating a webpart

For creating a new webpart, you can use following code sample:

using System;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

namespace Sample
{
   public class SampleWebPart : WebPart
   {
       [Personalizable, WebBrowsable]
       public String ContentText { get; set; }
       protected override void CreateChildControls()
       {
           Controls.Add(new Label {
               Text = ContentText
           }); 
       }
   }
}

Accessing session ID

When your webpart requires access to the session ID, you have two options: include a separate login on the webpart, or implement the functionality of Logicbase.ensemble.core so the webpart can retrieve the session ID.

namespace LogicBase.Ensemble.Core
{
    public class EnsembleHelper
    {
        ensembleHelper()
        {
        }

        public string EnsembleUrl
        {
            get
            {
                return HttpContext.Current.Request.ApplicationPath;
            }
        }

        public static string CurrentSessionID
        {
            get
            {
                if (HttpContext.Current.User is AbstractEnsemblePrincipal)
                    return (HttpContext.Current.User as AbstractEnsemblePrincipal).SessionID;
                else
                    return null;
            }
        }

        static EnsembleHelper helper = new EnsembleHelper();
        public static EnsembleHelper GetInstance()
        {
            return helper;
        }
    }
}

All access to Process Manager service functionality should come through web references. These web references enable the webparts to be hosted in other portals (like SharePoint).

The URL in the EnsembleURL property is the base URL to Process Manager. If you want to access docman, use this URL + "/docman/docman.asmx".

The CurrentSessionID represents the current user and is passed to the Process Manager services (as most services require the session as a parameter).


Once you've added the 'CreateChildControls()' build your component.

Check the output path

E:\Dev\WF\Protirus.ProcessManager.WebParts\..\bin\Debug\Protirus.ProcessManager.WebParts.dll

Copy the dll and add it to a folder on your WF Server.

You could create a Build Rule in VS to copy this to a holding folder ready for upload.


Protirus