Welcome to Office Zealot Sign in | Join | Help

Julie's Office Dev Blog

Sorta like yoga... just less flexible.
More Sharepoint Workflow Babbling

It's been a tough couple weeks.  While I've been able to successfully get my demos going in time for all my Proof of Concept demos, it hasn't been the easiest thing.  I've just sat and rebuilt my workflow from scratch for the 6th time.  That's what I get for trying to get fancy here and there.

Since many of my tasks are really the same basic sequence of events:  Create Task, Send an Email to Notify the user of the task, Log the task creation, wait for change, make the change, complete the task, delete the task, log task completion.  I tried to create an Activity Class, create the core set of events and then use that over and over again.  That was a complete waste of time.  I never could figure out how to get the correlation token right for the SendEmail event (since it needs to go to the workflowToken and not the parent sequence token).  I finally decided to axe that idea in an effort to get the thing done.

Next I decided to go ahead and create the whole workflow.  We've been redoing and redoing the workflow chart and this is currently what my work area looks like:

Since I had the POC working and I knew how to create the tasks.  I had the stupid idea of creating the majority of it at one sitting.  I have since learned that copying and pasting whole sequences is a BAD BAD idea.  I don't quite know why it is a bad idea but everytime I copied a sequence, changed all the properties I would get wierd errors or my entire workflow would break.  At one point the whole thing ran, then I changed a line of code which changed the AssignedTo user and BAM the whole thing broke to the point where I couldn't even get the first event to fire again.  In fact, I had to rewrite the whole thing in a new project to get it to run again.

Next on the list of gripes is that debugging is really really, well, buggy.  Sometimes debugging works as expected.  I run a workflow, attach to the workflow process, set my breakpoints and things go as expected... but sometimes, especially as the workflow gets bigger (and, as of right now, I'm unable to debug my workflow at all, I've taken to putting little notes in the workflow history so I know what's happening in the code).. .sometimes I get this mysterious error... the debugger tries to load the workflow designer and get an error about the ClassName.Class not being able to be deserialized so the workflow can't get loaded and the debugger doesn't work.  If I click continue the code fires off but it doesn't actually communicate with the server or something 'cause nothing actually happens.  Pretty frustrating... and I have no ideas how to solve it hence my backwards thinking push some notes into the workflow history (because as long as I'm not trying to debug things work fine).

Next on the list is I have no idea how to use the BeforeProperties properties of a task.  I create my onTaskChanged event, create a new field for the propery BeforeProperties... however when I then go and try to use it the values are the same as the AfterProperties.  I've been able to workaround this by creating a variable, setting the variable value as the first line in my onTaskChanged event to the workflowProperties.Item.ExtendedProperties[”myitem”] value and then comparing that variable to the AfterProperties value... I'm unaware if I have to do anything special to the BeforeProperties but it seems like it should be somewhat intuitive to use.

The workflow we are doing our pilot off of is pretty small in comparison to the much larger workflows we have planned... the designer is really really slow as your workflow gets bigger, even if you collapse most of your sequences.  After awhile I'm waiting good seconds just for the designer to catch up to me.... and sometimes, for no apparent reason other than to completely freak you out and drop your heart to your feet, the designer will show massive red exclamation points (meaning something in your event is broken) all over the workflow... but if you close the designer and reopen it, they'll go away.

Updating the workflow is much easier than I originally thought.  As long as the only thing you've changed is your assembly, you can just re-GAC it and the workflow does, in fact, pick it up.  If you've changed your InfoPath task forms or other things, it seems I have to actually deactivate and uninstall the feature, the reinstall and reactivate it.  Once you do this, you have to actually add the workflow back to your library.

Next tasks to figure out:

-- I created a list in Sharepoint to maintain some task assignment data.  Some of the tasks need to be assigned to a group rather than an individual.  I haven't figured out if this is possible.

-- System User.  In all of my workflow history event, the UserID is marked as System User.  I don't know why and I don't know how to change it.

-- I need to figure out how to log the actual user who “changed“ the task.  This will allow me to know who modified data in my workflow but, so far, I haven't been able to get this information.  I tried a bunch of stuff with SPContext but to no avail.

-- Find a way for an external process to talk to my Sharepoint Workflow.  I'd like to expose an ASP.NET page to an external resource, allow them to fill in some data, then have this data pushed into my workflow via a webservice.  I have read about the WebServiceReceive but am not sure exactly how it works with Sharepoint Workflows.  My other idea is to have the external data pushed directly into the Sharepoint item somehow but I don't know if the Sharepoint Workflow will recognize that the data is there and then start a new task based on it. 

-- Once I have this external data, the last thing I have to do is create a new Word document using all of the workflow data to populate the document, push the document into a separate Sharepoint list linked to the original Sharepoint Workflow Item (or perhaps push it as an attachment to the original Item -- not sure right now which way will be better).

Never one to take on small projects using Beta code am I?

Posted: Sunday, June 25, 2006 6:03 PM by jkremer

Comments

Anonymous said:

I hear you. Developing custom SharePoint workflows has got to be one of the most unintuitive developer processes associated with Office 2007. Occassionally there are flashes of functionality that make me thing "this is cool" but then the good feelings get erased by little things that seem so simple and innocent yet cause hours of frustration trying to figure them out or get them to work. Ugggh! If anything, it's nice to know it's not just me and that others are having similar experiences... Hang in there!
# June 26, 2006 12:35 PM

Anonymous said:

I don't know if this helps, but regarding the users who've done something...

In the OnTaskChanged activity, check out the 'executor' field - I think that's what you want. http://msdn2.microsoft.com/en-us/library/ms440815.aspx

Regarding assigning tasks to groups rather than users - yes, this is possibly. On the Task List web part there is a filter 'my Groups' (if memory serves - I'm not at work just now so I can't check). I'm fairly sure I tested this a week or two ago.
# June 29, 2006 3:47 AM

Anonymous said:

Andy,

That was what I was looking for... I still don't know why System User is logged in the workflow history all the time or how to change it but I suppose I'll get there :)

I haven't actually tried assigning a task to a "group" yet but it's next on my list of things to do.
# July 3, 2006 7:41 PM

Anonymous said:

I know these are more questions than feedback. I tried using the contact page but it said something about the mail server being unavailable.

I have been running into many of the same issues. One of the problems I have been experiencing is a missing dll named Microsoft.Office.Workflow.Feature which the CallbackReciever expects in the default Feature.xml with a Windows Sharepoint Services Sequential Workflow Project Template. Did you encounter this as well? Did you end up creating your own CallbackReciever or was there a fix?

Also, what modifications did you make to the install.bat to make it work correctly? I have been running into issues with it not uninstalling the feature (if I make updates and need to reinstall) even though I uncommented those lines in the bat file. When I do install the second time and try to activate the feature it says a feature with that id has already been installed EVEN if I change the GUID in the feature.xml.
# July 7, 2006 6:35 AM

Anonymous said:

Don't know about the CallbackReceiver - I didn't have any problems with that.

Personally, the only things I had to modify I had to modify were those described at the top of the install.bat file...

When reinstalling the feature, I didn't have to change anything. It just overwrote whatever was there. I must have reinstalled the same workflow feature about 80-90 times, and as long as I had dis-associated it from any lists using it, it worked just fine.
# July 10, 2006 3:03 PM

Anonymous said:

I posted in the "microsoft.public.sharepoint.development_and_programming" newsgroup on assigning a task to a group instead of a single user. As you will notice it is possible to assign a task to a group, but then i got a problem. The post doesn't really solve any problems, but read on your own... (and if anyone has any solution for the problem it would be nice to provide it in the above newsgroup under the Subject: workflow problem with claiming a task 7/4/2006 6:43 AM PST )

I wrote:

Hi,
I have a problem with claiming a task that was assigned to a group within a workflow.
When i assign a task in a workflow to a group (e.g. site members) and not to a specific person, i have the possibility to "claim the task" when i edit the task (this "claim task" link shows up in the "toolbar" where you can normally only delete a item, when you edit a task).
But when i click on this link, edit the "claimed" task and submit it i receive an error...

Does anyone know how to solve that?
I think i have to catch some event that is fired when i claim the task...but
which? Or am i completely wrong with that?

# July 14, 2006 1:52 AM

Anonymous said:

hi,
i'm also having problems with associating infopath form with a workflow. i'm positively sure, that i've set everything up properly, but the error "The specified form cannot be found" still appears. should the installed IP form appear in the "Manage Form Templates" part of central administration. I think that the installer doesn't install the form.
any help needed ( it's the 2nd day i'm trying to make it work )
thank you in advance,
dominik
# July 21, 2006 5:53 AM

Anonymous said:

Hi Julie,

It great to see all that you could accomplish :-)
I am still trying to figure out some things in SPS 2007.
Could you please advise me about how I can do this?

In an workflow I am designing in SPS designer, I need to add a custom action or activity to update a sql server DB. Can this be done?

Should we use VS2005 to add a custom action or activity?

Please help
Mark
# July 21, 2006 3:04 PM

Anonymous said:

Hi,

I tried assigning a task to a group using the Sharepoint Designer. The designer doesn't give any error when trying to do this; however, when the task is actually created, it is not assigned to anyone!!! The rest of the fields are populated, but the "Assigned To" remains blank. Do not know if I am doing something wrong or if this is a bug in either the designer or the server.

# July 24, 2006 12:03 PM

Anonymous said:

To Dominik --

Sorry if this is late and you've got it already. Make sure your Association and Initiation forms are in the feature folder after running the install.bat. So in your feature folder (located at program files > common files > microsoft shared > web server extensions > 12 > templates > features > [[your feature name]]), there should be the feature.xml file, the workflow.xml file and what ever task or initiation forms you are using.

You can also check the Manage Form Templates dialog after installing your feature because whatever forms are in your feature folder should appear there.

I've started running the command lines manually instead of using the install.bat (at least until I have everything working then I may look at that thing again). This way I KNOW they're in there.

HTH
# August 17, 2006 7:32 AM

Anonymous said:

Ok the thing that was not obvious for me with InfoPath forms (since I did not work woith them b4) is the fact that you need to PUBLISH them.

Also when you see a form in Windows explorer you need to right click it and choose DESIGN.

When open select publish from file menu.

Select a location in sharepoint server and in the dialog where you are asked for alternate path leave it EMPTY!!! IGNORE the warning about access rights.

Now try to deploy. Does it work?
# August 21, 2006 11:50 PM

Anonymous said:

I used to get a lot of crashed when Debuging MOSS Workflow solutions in VS2005.

I found that there is an extra step after selecting attached to process that helps :)

========================================
Make sure that Attach to: is set to Workflow code. If necessary, click Select, and in the Select Code Type dialog box, check Workflow and click OK.
========================================


# August 22, 2006 12:03 AM

Anonymous said:

I'm glad I came across this blog post. I've been feeling like a moron after spending hours trying to write custom workflows. It's truly depressing -- stuff that look so simple that it just has to work often doesn't. My latest joy is a onTaskChanged activity handler that just isn't able to get the PercentageComplete out of the task properties (after change occurs). I get the proverbial "Error has occurred in HandyDandyWorkflow" whenever I try and retrieve the percentage complete value. I know it's not much consolation, but I'm glad at least I'm not the only one out there.
# October 7, 2006 6:43 AM

stefan @ decatec said:

# January 16, 2007 3:30 AM

kab710 said:

I'm also glad to know I'm not alone!!  My workflow only works if it's manually started.  Otherwise I get "Error updating a list item, Access Denied"

Argh!!!

# March 20, 2007 1:21 PM
Anonymous comments are disabled