3 Replies Latest reply on Apr 4, 2013 12:06 PM by Steve Bishop

    Using Powershell in LiveCycle Workbench

    sgarciacode Level 1

      Hello Everyone,

       

      I am attempting to revamp a daily process that we do at my job. What I want to do is set up a workflow in workbench which will walk the user through the process step by step. As the user goes through the steps I want them to check the item off and then i want workbench to execute a powershell script or Batch file which will complete that part of the process. Once that script is run, the user can move on to the next step in the process. Is this something I can do? And if not can anyone recomend a software that can?

       

      Thanks in advance,

       

      sgarciacode

        • 1. Re: Using Powershell in LiveCycle Workbench
          Steve Bishop Level 2

          Workbench is the tool to write a process. Wouldn't your end user be in Workspace?

           

          If these scripts can be run from the server, then you could wrap them with a process that uses an execute script step:

          Runtime.getRuntime().exec("something.bat");

           

          You could then call that process as a webservice from a form when the user clicks the check box.

          • 2. Re: Using Powershell in LiveCycle Workbench
            sgarciacode Level 1

            Hello Steve,

             

            Yes sorry that is correct, I would be writing the process in workbench and the user would be using workspace. Thank you for the advice, I tried using that and the problem I am having is setting the directory that the .bat file is in. Can I run .bat files that are not on the LiveCycle Workbench Server? For example, I want to run a .bat file in another shared network drive.

             

            Runtime.getRuntime().exec("C:\\Documents and Settings\\sgarciacode\\My Documents\\CONTROL.BAT");

             

            When I try running this it uses the default workbench path. So when I try running this, it says that the file does not exist.

             

              String[] command = { "cmd.exe", "/C", "Start", "CONTROL.BAT" };

                            Runtime r = Runtime.getRuntime();

                            Process p = r.exec(command);

                            p.waitFor();

             

            Also I am not to familiar with the Webservice Foundation Service, could you please provide an example of how to use this or a link to where I could read more about it?

             

            Thanks for the help.

            • 3. Re: Using Powershell in LiveCycle Workbench
              Steve Bishop Level 2

              The path would have to be as seen from the server, not how it would be seen from your local machine running Workbench. You would either need to copy it to the server or copy to a shared network drive that can be seen by both your local machine and the server. The second one would be easier to keep track of if you used the same network drive letter on both machines.

               

              To make your process available as a Webservice, you just have to have SOAP checked in the settings on the big green arrow put at the start of your process. That is the default.

               

              Here is some info for connecting to a webservice as a Data Connection in a form. I do it in JavaScript, but this might be easier for someone who has not done it before.

              http://forms.stefcameron.com/2007/05/21/connecting-to-a-web-service/