Slinger's Thoughts

February 13, 2008

Custom Workflow in SharePoint Designer still doesn’t quite work right.

Filed under: SharePoint — slingeronline @ 10:18 am

A short while back I posted about some problems I was having with a custom training class solution that could be found at SharePoint Beagle. Through the comments on that post, I have gotten closer to an answer, and I know where the problem lies, but for the life of me I still can’t quite get it to work as advertised.  To get started on it that post is here.Well if you read the comments in my previous post, you will see that the variable that was not getting passed was set in the javascript on the form action button.  I decided to test this.  I removed the redirect function, and tested out the solution.  One of the problems that I was having was that I would never get redirected to the list view page anyways, so I wasn’t going to lose any functionality that I already had by leaving this out.  I clicked the button, and then once the page refreshed, I checked the list.  Perfect! All of the appropriate information was passed, and it was all correct.  Even the filtering option worked great.  So now I know where the problem is.  It’s that redirect call.  Something in that is not working for me the way it should.  An example of the code that I have in place is as follows.

javascript: {ddwrt:GenFireServerEvent(concat(‘__workflowStart={{4F07C1C1-35F0-445F-8E85-91464F99636D},New,{FEA33621-15A0-4155-BA73-606B9CF9E0A2},ClassID=’,@ID,’}’))}

I copied this into notepad to make it easier to read. (I’m not a javascript expert, but I would imagine that most of the punctuation needs to be closed so I trimmed it out like so:

javascript:
{ddwrt:GenFireServerEvent
 (concat
  (
   ‘__workflowStart=
    {
     {4F07C1C1-35F0-445F-8E85-91464F99636D}
     ,New,
     {FEA33621-15A0-4155-BA73-606B9CF9E0A2}
     ,ClassID=
      ‘,@ID,’
    }
   ‘
  )
 )
}

And like this it works great, with one exception.  There is no redirect.  __redirect={MyClasses.aspx}  was the only thing I left out of the code.  It technically should appear like this, at least according to the article.

javascript: {ddwrt:GenFireServerEvent(concat(‘__workflowStart={{4F07C1C1-35F0-445F-8E85-91464F99636D},New,{FEA33621-15A0-4155-BA73-606B9CF9E0A2},ClassID=’,@ID,’}__redirect={MyClasses.aspx}’))}

I copied and pasted this directly into SharePoint Designer, and my Dataview Web Part in the preview shows something interesting.  There is an invalid number of arguments in this code.   The error message points to the “concat” but I know this is incorrect.  Somewhere though, I’m either closing a tag early, or leaving one open. So I will break this down like I did before.

javascript:
{ddwrt:GenFireServerEvent
 (concat
  (
   ‘__workflowStart=
    {
     {4F07C1C1-35F0-445F-8E85-91464F99636D}
     ,New,
     {FEA33621-15A0-4155-BA73-606B9CF9E0A2}
     ,ClassID=’,@ID,’
    }
    __redirect=
    {MyClasses.aspx}
   ‘
  )
 )
}

It all seems right, but that doesn’t change the fact that it doesn’t work.  Before I move any further with this solution, I want to make sure that this part is working properly.  And just to be sure, I set the redirect to any number of places.  It’s not redirecting.  If someone can find the magic thing that I am missing, please let me know.

Advertisements

3 Comments »

  1. Well, we have an answer. If you add a ; right before the __redirect command, the workflow solution suddenly works beautifully. One change that I did have to make, was to include the path for the “MyClasses” view. I don’t know why that is, I tried to save the page that I created in SPD in a different location, but that just popped up an error message when I tried it. It’s easy to handle though. Many thanks to Natalya for her fantastic solution. Now I am going to try and tweak it a little bit, and that will be in a forthcoming post.

    Comment by slinger — February 13, 2008 @ 4:01 pm

  2. I am new to MOSS development. How do i get the GUIDs 4F07C1C1-35F0-445F-8E85-91464F99636D and FEA33621-15A0-4155-BA73-606B9CF9E0A2. What IDs are these?

    Comment by Aishwarya — April 26, 2009 @ 3:18 am


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: