none
Site Definition that Includes SPD workflows

    Question

  • Greetings,

     

    I'm working with a colleague to create a site defintion that includes a list with an attached SPD based workflow.

     

    I'm assuming this is possible because I know that some (maybe all?) of the "fab 40" templates include workflows that may be edited using sharepoint designer.

     

    I have spent a few hours looking at the Absense and Vacation Schedule site defintion which includes some very simple workflows similar to what we want.

     

    One of <Module> bits is this:

     

    Code Snippet

     

      <Module Name="Setup" Url="Workflows/$Resources:tsa,Setup;" Path="" >
        <File Url="_tsafix_Setup.xoml.wfconfig.xml"></File>
        <File Url="Setup.xoml.rules_fixtsa_.xml"></File>
        <File Url="Setup.xoml_fixtsa_.xml"></File>
      </Module>

     

     

    if I look at the Setup.wfconfig.xml I see this:

    Code Snippet

    <?xml version="1.0" encoding="utf-8"?>
    <WorkflowConfig>
        <Template
            BaseID="{22CE8EB9-75F5-41C8-8C3E-7B64FA57F9C7}"
            DocLibID="%TSATOK:ListId(Workflows)%"
            XomlHref="Workflows/$Resources:tsa,Setup;/Setup.xoml"
            XomlVersion="V1.0"
            RulesHref="Workflows/$Resources:tsa,Setup;/Setup.xoml.rules"
            RulesVersion="V1.0"
        >
        </Template>
        <Association
            ListID="%TSATOK:ListId($Resources:avm,Absences;)%"
            TaskListID="%TSATOK:ListId($Resources:core,taskList;)%"
            StartOnCreate="true"
        >
        </Association>
        <ContentTypes>
        </ContentTypes>
        <Initiation URL="Workflows/$Resources:tsa,Setup;/Setup.aspx">
            <Fields />
            <Parameters></Parameters>
        </Initiation>
    </WorkflowConfig>

     

     

    I can think of a lot of ways to interpret that and I'm getting ready to some old fashioned reverse engineering.

     

    I've done some searching and I can't find anyone blogging about adding SPD worfklows to site definitions. 

     

    If anyone has experience with this and is willing to share, I'm all ears!

     

     
    Friday, March 14, 2008 3:58 PM

Answers

  • Hello Paul,

    Microsoft application templates use a feature called: PostProvisioningFeature. It runs an Event Handler on activation which replaces literals like %TSATOK:ListId($Resources:absences,AbsencesWink% with the ID of de List. This feature is executed at the end of deployment process of every template solution.

    This feature is deployed with de Core Solution and the code is in the library: PostProvisioningFeature.dll. You can use the application Reflector to view the code. For example, the code also remove the literals "_tsafix_" in the files of the module features, like in AVMModules (although i don't know why).

    Now i'm working in the same task. We want to reuse the Absences template with some improvement. I think we'll have to use these feature to achieve the replacement of the ListID.

    If a find any other solution i'll post it here,

    Best regards,
    Raúl Truco

    Tuesday, March 18, 2008 2:53 PM

All replies

  • I know Todd Bleeker is doing a lot of stuff on converting SPD workflows to VS workflows (he had a pretty good presentation at SPC 2008).  I haven't done this but my gutt tells me that it wouldn't work (I guess I'd first ask why you'd want to do it rather than converting it to a VS workflow (besides the 3000 steps it takes to make it work)).  I'd recommend getting in touch with Bleeker and seeing if he has any thoughts.

     

    • Unmarked as answer by Mike Walsh FIN Wednesday, September 24, 2008 7:09 AM
    Sunday, March 16, 2008 12:38 AM
  • (I didn't mark this as answered, FYI).

     

    I'd rather do it via SPD because using visual studio is much more difficult than using SPD for this particular project.  SPD meets all the requirements.

     

    This is still an open (unanswered) question if anyone has any thoughts.

     

    I am sort of optimistic that it can be done.  Consider the absense and vacation schedule template.  I install that template and create a site.  I can open up that site using SPD.  I can locate a workflow in that site which I can now open, modify and save using sharepoint designer.  (In fact, there is a bug in the training template that I have fixed using SPD).

     

    It may be that this was created using visual studio and that I am able to edit it using SPD.  Is that what's really happening here?

     

    What about that TSKTOK reference? 

     

     

    Sunday, March 16, 2008 2:17 PM
  • I think Paul Andrew gets a little over zealous in marking posts as answered Smile (I believe that, as the post originator, you can mark the post as unanswered)

     

    Sunday, March 16, 2008 11:44 PM
  • Yup, I've been pretty free lately with awarding the Answered tag. But I've finished just today and we're caught up all 15 months of the forum history marking answers so from now I'll be able to read a bit slower before marking answers. Generally though if you take the time to reply and give someone a pointer that they can learn how to solve the problem I'll mark it. The original poster is free to unmark it of course. I think this makes for a more healthy forum.

     

    Regards,

    Paul 

     

    PS: Off topic - sorry.

    Monday, March 17, 2008 12:42 AM
  • You're not going to like my take on this.

    IMO SPD workflows are great, until you need to make them portable, then they are HORRIBLE!

    You could try saving the site as a template and using that, it *might* work, it might not either, and you might find that sometimes it does work and sometimes it doesn't Indifferent

    I've tried exporting SPD workflows and importing them in to VS to create WF Features, but I've not had any real success.

    Bottom line, if it has to be reusable and portable, go for Visual Studio.
    Tuesday, March 18, 2008 2:28 AM
  •  

    I know what you mean.  I wrote about one migration "success story" yesterday here: http://feeds.feedburner.com/~r/PaulGalvinsSharepointSpace/~3/253315070/cns!1CC1EDB3DAA9B8AA!858.entry

     

    I'm not quite ready to give up though. 

     

    That fact is that it works in the Microsoft fab 40 templates, so there is a way to do it.

     

    It's absolutely possible to migrate declarative workflows since there's clear evidence that Microsoft does it successfully with their templates.  It's just a question of how to wave the magic wand and how many chickens you have to kill to make it work.

     

    Tuesday, March 18, 2008 12:10 PM
  • Hello Paul,

    Microsoft application templates use a feature called: PostProvisioningFeature. It runs an Event Handler on activation which replaces literals like %TSATOK:ListId($Resources:absences,AbsencesWink% with the ID of de List. This feature is executed at the end of deployment process of every template solution.

    This feature is deployed with de Core Solution and the code is in the library: PostProvisioningFeature.dll. You can use the application Reflector to view the code. For example, the code also remove the literals "_tsafix_" in the files of the module features, like in AVMModules (although i don't know why).

    Now i'm working in the same task. We want to reuse the Absences template with some improvement. I think we'll have to use these feature to achieve the replacement of the ListID.

    If a find any other solution i'll post it here,

    Best regards,
    Raúl Truco

    Tuesday, March 18, 2008 2:53 PM
  • I KNEW it was something like that.  I'll be digging into it myself as time allows. For now, we've realized we can just out of the box workflow attached to a content type and that works for us in this specific case.  But, site definitions are the wave of the future and probably, as a rule, everything should be created that way in order to sync with proper SDLC.

     

    Thanks, that's very helpful.  I've seen this pattern in a couple of templates and have been working my way up towards creating a very simple site definition with a very simple workflow to test it out.  I'll post anything I find and blog about it.

     

     

     

     

    Tuesday, March 18, 2008 2:59 PM
  • Raul: That's great info, thanks Smile

    Paul: I'm leaning towards minimal site definitions with feature stapling as the way forward this still syncs with good software methodologies and promotes re-use of features.

    -Gavin
    Tuesday, March 18, 2008 7:15 PM
  • Thanks Paul Gavin,
    It helps me. Now I can deploy my Site Definition to production server.
    Thursday, July 10, 2008 8:31 AM
  • Hello Raul,

    Were you ever successful in reverse engineering the "PostProvisioningFeature" methods to mimic what Microsoft had done in deploying their SPD-created templates (like Event Planner)?

    I am at this decision point as well, and just want to know whether to give up now, or plow forward...

    Kurt
    Neudesic
    Saturday, September 13, 2008 6:59 PM
  • Hi Kurt, i got to view the entire code of the library PostProvisioningFeature successfully and also another libraries pertained to the templates. I'm sure you will be able to view them without problems. On the other hand, i was not able to do de same with core libraries of the WSS setup (Microsoft.Sharepoint.*). They are all obfuscated.

    Another trick would be changing the wsp extension of the solutions as zip file, and openning them with Winrar (Windows zip doesnt work). You will get all the files and you will be able to modify files and repack them again in your own solution. Good luck!

    Regards,
    Raúl,
    Tuesday, September 23, 2008 10:56 PM
  • >I think Paul Andrew gets a little over zealous in marking posts as answered Smile (I believe that, as the post >originator, you can mark the post as unanswered)

    I saw this and unmarked it.

    There's in any case now another reply in the thread which is marked as an Answer and it's longer than yours :)




    Wednesday, September 24, 2008 7:11 AM
  • Can anyone please post more information on this, or a link elsewhere with more specifics?  I'm not finding any more detailed information on this, and I'd like to use the same methodology....

    Thanks.
    CDMondo
    Monday, November 16, 2009 7:38 PM