Blog of an overweight SharePoint addict

Wed 23 Apr 08

State Machine.. like pulling teeth?

Filed under: Infopath, Programming, SharePoint, Visual Studio 2005, Workflow — Reginald @ 1:32 pm

Well almost, Had a minor break from the work this morning to have a cracked tooth looked at, Unfortunatley it was too badly damaged and it’s had to come out.. Well the novocain or whatever they use nowadays has well and truly worn out and yours truly is hitting the Ibuprofen hard!!

So, to ease the pain, I’ve focussed on some issues around the workflow edit form today. The users want to be able to set a status on an item using a drop down menu. This is nice and easy as we’re pre-setting the values in the form, just Yes, No and Not Applicable.

All well and good, I’ve built the new area on the form and added the drop down, the value is being passed happily to the backend and the previously selected value is being placed into the ItemMetaData by the workflow.

The issue I have now, is how do we take this returned value once the workflow is underway and ensure that the user is presented with the correct value when the form loads.. The dropdown list doesn’t let you map to the ows_ItemMetaDatalable like a text box does..

I’m busy re-searching this now and have placed a few posts on some dev forums, watch this space for a resolution..

Reg.

Fri 18 Apr 08

State machines cont….

Filed under: Uncategorized — Reginald @ 4:04 pm

Well I’ve had some fun doing the layout of the workflow onto the state machine designer page. It’s certainly a very different feel to building the Sequential style of workflows and I can understand why anyone who has developed the state machine workflows always says, ‘mess around with Sequential ones first”.

There is a very different feel to the designer when working on the State Machine WF, it feels quite disconnected once you start drilling down into the various state containers and can be a little hard to picture until you return to the top down view and can see the various state changes in line form on the designer.

In order to try the SM workflows out, I’ve decided to port the Finalisaton workflow from our current system into the SM way of working. This fits with the project as the finalisation never reached live owing to the repeated changes requested by our finance team. therefore I’m almost at the blank canvas stage which is a great place to start.

Well so far I have the basic workflow design layed out on the canvas, I’ve got the initialisation underway pulling in both association data and initiation data from the XML data in the workflow, The task logic is almost complete and the task creation is almost there. I’ve had to leave it at the point with copious notes in the code ready for when I can return to it next week.

Watch this space for a report on how the first deployment goes and what I’ve learned about state machines!

Thu 17 Apr 08

Time for a state machine?

Filed under: Uncategorized — Reginald @ 8:51 am

The library summary webpart that I’ve been working on over the last week is now at a point where I can put it in front of the UAT board and show them the different flavours. Flexibility was the key with this part as I wanted to avoid having to keep re-writing webparts for each different team.

I’ve used personalisation menus quite heavily with this one and it’s working quite nicely, even if some of the logic within the code has to be quite convoluted.

Anyways, the UAT meeting isn’t until this afternoon, so yesterday I decided to take a look at a state machine workflow.

I found a fairly good walkthrough on the net that seems to cover the ground quite nicely, available here:- Matt Morse – State Machine

I’m adapting the basic walkthrough to meet my requirements, Hopefully I’ve built up enough knowledge on the workflows to get this working without doing a sandbox first, but we’ll see.

Tue 8 Apr 08

Dropdown option lists in webpart personalisation menus

Filed under: Installation, Programming, SUGUK, SharePoint, Visual Studio 2005 — Reginald @ 2:57 pm

I’ve been writing my own SharePoint webparts for a few months now and have been quite happy using personalisation options to provide a certain degree of control during runtime from the Edit Shared Webpart properties menu.

All of these controls have either been using a text box entry or a tick box boolean, Until now that is. I realised that I needed to have some form of control over what was being entered by the admin. After all, whilst it’s always good to make sure that you validate any user input, it makes sense to restrict that input to selected options when possible.

In my case, I want the admin to be able to choose between which teams to filter the inbound data on, this in turn was then fed into a CAML query to return the correct data for the webpart.

After much reading of logs and blogs, I posted a quick question on the SUGUK forum and one of the readers, Paul Leigh suggested I look at using an Enum to provide the drop down.

Quite intrigued, I brushed off my c# text book to remind me how to define an enum, and set off on the following code.

First we define the enum within the webpart class boundary.

Public enum resourceTypes : int
{
NR,
Projects,
Windows,
Networks,
Unix,

snipped......

FirstAssist
};

Now we need to define the public and private members of the class, You don’t have to do this, but it’s best practice!


private resourceTypes m_resourceFilter;

[Personalizable(PersonalizationScope.Shared), Category("ESSOP"), WebBrowsable(true), WebDisplayName("Select team to filter results by")
, WebDescription("Use NR value when not required.")]
public resourceTypes resourceFilter
{
get {return m_resourceFilter;}
set {m_resourceFilter = value;}
}

Thats really all there is to it, in my case, i evaluate the enumeration using the ToString method and push that into my query string.

NB: You can only use a single word in the enum, spaces aren’t allowed, so in order to get around some of my teams that have double barrelled names, I put a Select statement further down the code at the injection point into the CAML query….


switch (m_resourceFilter.ToString())
{
case "StorageBackup":
resourceSelection = "Storage & Backup";
break;

case "TechOps":
resourceSelection = "Tech Ops";
break;

case "FirstAssist":
resourceSelection = "First Assist";
break;

case "BusinessAssurance":
resourceSelection = "Business Assurance";
break;

default:
resourceSelection = m_resourceFilter.ToString();
break;
}

Hopefully this might give you some pointers to solve a similar issue in your projects.

Regards

Reg.

Fri 4 Apr 08

Building servers?

Filed under: General — Reginald @ 1:52 pm

I’ve been somewhat remiss recently with updating the blog, so those of you looking forward to another installment of Workflow issues and resolutions are I’m afraid out of luck this week.. The workload here at the normal place of work has gone sky high as our various clients tried to beat the end of the financial year.

The last week or so has seen me returning to my previous duties of building physical and virtual servers for various clients, and more importantly, actually becoming a user of the system that I’ve spent the last 9 months building.

And this is quite key, I would suggest that any of you writing such a system, should definately walk a mile in the users shoes.. it gives you an interesting perspective on the system that you thought you were familiar with. As a result of this, I’ve come up with a couple of screen improvements that should make our users lives just a little bit easier.. I’ll be building these next week, right now, I have to go and finish unpacking 250 HP disk boxes ready to install into the 57 servers we’ve just installed in the racks today.

We’ve filled 7 recycling bins with corrugated cardboard, and probably have enough for another 7.. Does each individual disk really need this much packaging?

Reg.

Powered by WordPress