8 Replies Latest reply on Jun 16, 2016 10:04 AM by Dori Bearham

    Execute a Px task from a console app?

    Dori Bearham

      I have configured a process framework task to send information to our work management system. The task works beautifully in workflow manager. Then I wrote a console app (VS 2013/.NET 3.5) to execute that task. It gets the ESRI and Designer licenses, creates the PxLogin object and connects with the right connection string, and gets the PxApplication. Then it gets the IMMPxNode and the IMMPxTask. Then it checks to make sure the task is enabled, and if it is, then uses IMMPxTask.Execute(IMMPxNode) to execute the task. It returns false. I've triple checked that all subtasks are enabled so I don't understand why it's failing. Especially since it executes fine in WFM. Am I missing something? Am I using the wrong method?

        • Re: Execute a Px task from a console app?
          Josh Pritt

          It sounds like one of the subtasks assigned to that task is returning False from its Execute() method.  There might be some code in the subtask execute method that is failing or throwing an exception.  Have you checked the Miner event log for any error messages?  Another test to help troubleshoot would be to try to execute the same task from standalone workflow manager outside of ArcMap with the start menu shortcut: All Programs -> ArcFM Solution -> Process Framework -> Process Manager.  If the task executes OK from there then it should execute OK from a console app.

          • Re: Execute a Px task from a console app?
            Kyle Baesler

            Dori, Are you making a connection to the process framework using the IMMPxApplicationEx.Startup and specifying the IMMEnumExtensionNames object?

              • Re: Execute a Px task from a console app?
                Dori Bearham

                No I'm using this with an adob connection object


                IMMPxLogin pxLogin = new Miner.Interop.Process.PxLoginClass();

                pxLogin.Connection = connection;

                _PxApp = new PxApplicationCalss();



                Do I need to use IMMEnumExtensionNames outside on ArcMap?

                  • Re: Execute a Px task from a console app?
                    Kyle Baesler

                    You know, I've always specified the extensions that I needed so I'm not positive if it is required.


                    You can try using the following snippet to connect to the PX to confirm, if it doesn't work, we can at least rule out 1 thing.


                    public virtual IMMPxApplication Open(string connectionString, string userName, params string[] extensionNames)


                                if(connectionString == null) throw new ArgumentNullException("connectionString");

                                if(userName == null) throw  new ArgumentNullException("userName");

                                if(extensionNames == null) throw new ArgumentNullException("extensionNames");


                                // Open the connection with the given properties.

                                Connection connection = new ConnectionClass();



                                // Create PxLogin object.

                                IMMPxLogin pxLogin = new PxLoginClass();

                                pxLogin.Connection = connection;


                                // Load the extensions.

                                IMMEnumExtensionNames extensions = new PxExtensionNamesClass();

                                foreach (var extension in extensionNames)



                                // Initialize the application using the user name and extensions.

                                IMMPxApplication pxApp = new PxApplicationClass();

                                var pxAppEx3 = (IMMPxApplicationEx3) pxApp;

                                pxAppEx3.Startup(pxLogin, extensions, ref userName);


                                return pxApp;