13 Replies Latest reply on Jan 20, 2009 12:56 PM by Christina Seay

    Start template from within workflow

    Adam Meyer
      Is it possible to start a template from a state in a workflow?

      For example, once a drawing has passed review, an ECN is automatically created with the information about the change pulled from the drawing.

      Thanks,

      Adam
        • Start template from within workflow
          Christina Seay
          What type of document is your ECN and what information are you wanting pulled from the drawing?

          You can use Dispatch to create an action to copy a template file from one location to another.. I do this for checklists. When a user submits a drawing for approval I copy a template Word checklist from a template folder into the same folder as the drawing being submitted for approval and I push it through the workflow to the "Waiting approval" stage.

          You're supposed to be able to read/write from PDM variables and Microsoft Office files, there is some information in the admin guide for it, but I haven't tried doing that yet. So you might take a peek there and read the Dispatch guide that comes with your PDM installation in the Support folder on the CD and you should find what you need.
          • Start template from within workflow
            Adam Meyer
            Hi Christina,

            I'm making some good headway with Dispatch. Do you know of a way to have Dispatch modify a variable in Enterprise? For example, I'm using Dispatch to create a copy of a part with a difference filename. I'd like to also update the part number variable for the selected file, but I can't seem to find a way to do this.

            Thanks,

            Adam
            • Start template from within workflow
              Christina Seay
              Hey Adam,

              I don't know of a way using Dispatch to write to a variable... but it's a really simple little program to put together in VB and then you can kick off that program as an add-in with Dispatch.

              Do you have Visual Studio, or can you download Visual Studio Express (free version)?
              • Start template from within workflow
                Adam Meyer
                Nope, haven't ventured into making my own add-in yet.
                • Start template from within workflow
                  Christina Seay
                  I would suggest going ahead and grabbing the free version of Visual Studio. Dispatch can handle some basic actions, but you'll be able to do much much more with vb.net add-ins, and they're really not all that hard to put together. Especially if you grab:
                  http://extensiblecad.com/words...omagically-delicious/

                  That little add-in template is a life-saver!!

                  The only other way that I know of to write to a variable on a data card is with workflow transition actions... would that work in your case? I think it's called update variable or something to that effect when you're in the transition action editor in your workflow. That's going to update the variable on the card of the file going through that transition... so I'm not sure if that'll work for you or not.
                  • Start template from within workflow
                    Adam Meyer
                    Thanks,

                    I think the workflow method will work.
                    • Start template from within workflow
                      Christina Seay
                      Ok... I think it's pretty straightforward, and there's some documentation in the Admin guide for PDM on how to set transition actions... but if you get stuck on it, just let me know and I'll try to explain how to set it up a little more thoroughly.
                      • Start template from within workflow
                        Amit Chen
                        Adam and Christina

                        I think that connecting the templates to workflow can be grate tool.
                        It will solve many daily tasks.
                        The same way that I'm setting variables or sending mails during workflows transitions I would like to have the option to start template.
                        Whet do you think?
                        Thanks,
                        Amit
                        • Start template from within workflow
                          Christina Seay
                          Amit,

                          I'm not sure if you can actually "start a template" from the workflow.

                          But, all PDM is doing when it starts a template though is to copy a "template" file from a specified location into the new location and rename it. You can do all that through dispatch and set the dispatch action to happen when something goes through a specified workflow state.
                          • Start template from within workflow
                            Amit Chen
                            Christina,

                            Id did it but still there are some missing features that I've when using PDME templates.
                            E.g. I would like to copy a word file from one folder to another and this is easy to do with dispatch.
                            in addition I would like to generate serial number for the document name and to add variables to the office document from the cad document that passes the transition.
                            I'm not sure that I'm clear enough.
                            I know that I can reach my target when I'm using the PDME templates but I would like to trigger it by workflow.

                            Thanks Amit
                            • Start template from within workflow
                              Christina Seay
                              Amit,

                              I don't know of a way to trigger the PDME templates with a workflow... that doesn't mean there isn't a way, I'm still learning a lot of this too... but I don't know of one.

                              If you're needing to generate serial numbers as well as copy a file from one folder to another and name it from the serial number and pass variables from the cad document to the generated word document, then I think you're going to have to make an add-in. You can do all of that through an add-in and then use the "Execute Command" transition action on your workflow to kick off the add-in.

                              Your program would basically need to:
                              1. read information from the cad file that needs to get put into the word doc
                              2. grab a serial number
                              3. copy the template word doc from the templates folder into the new location and use the serial number as new name in the copy file command
                              4. write the variables that you gathered from the cad file to the word doc
                              5. check in the word doc
                              6. Possibly kick the word doc through the workflow a bit if you needed it to do that

                              You can do all that with an Add-in... just grab the add-in template for Visual studio that I mentioned earlier in this thread and look in the API help file for PDM for examples of all of these bits of code.
                              • Start template from within workflow
                                Amit Chen
                                Thanks for the structure and Yes I've already looked at it.
                                The problem is that I have no expriance with API.
                                • Start template from within workflow
                                  Christina Seay
                                  I didn't have any experience with API either until a couple of months ago when I had to start doing things with PDM that dispatch and the built-in workflow stuff couldn't handle doing.

                                  That add-in template will get you going in the right direction really quickly and people in the forum are just wonderful at helping with things.

                                  I think that structure should work for the order you'd need to do things in... generic of course... you'll have more stuff in between those steps... like logging into the vault first, etc... but most of that's covered in the API examples for each process.