Select to view content in your preferred language

Solved. Cannot run a custom ArcGIS Pro Command in a Workflow Manager Server step

1103
7
Jump to solution
12-21-2023 06:10 PM
MarkMindlin_idea
Regular Contributor

We have a custom ArcGIS Pro Command (addin) in a Workflow Manager Server step not working.

How could we debug or see whatever logs? 

 

MarkMindlin_idea_0-1703210942410.png

 

Solved

You should add to Module file following code

Please see the following sample for configuration needed for custom add-in to run during open pro project items step:

https://github.com/Esri/workflowmanager-samples/blob/master/ServiceBased/ProAddIn/WorkflowManagerSam...

        /// <summary>
        /// Override this method to allow execution of DAML commands specified in this module.
        /// This is needed to run commands using the Open Pro Project Items step.
        /// </summary>
        /// <param name="id">The DAML control identifier.</param>
        /// <returns>A user defined function that will execute asynchronously when invoked.</returns>
        protected override Func<Task> ExecuteCommand(string id)
        {
            return () => QueuedTask.Run(() =>
            {
                try
                {
                    // Run the command specified by the id
                    IPlugInWrapper wrapper = FrameworkApplication.GetPlugInWrapper(id);
                    ICommand command = wrapper as ICommand;
                    if ((command != null) && command.CanExecute(null))
                        command.Execute(null);
                }
                catch (Exception e)
                {
                    ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show($"ERROR: {e}", "Error running command");
                }
            });
        }

 

 

1 Solution

Accepted Solutions
MarkMindlin_idea
Regular Contributor

@StefanDieters1 It is solved. I updated the main topic

View solution in original post

0 Kudos
7 Replies
GKmieliauskas
Esri Regular Contributor

Hi,

If you have code of custom add-in, it is the same as debugging add-in. Start add-in debugging from Visual Studio. Place breakpoint inside Custom Command OnClick() method. Then execute workflow.

0 Kudos
MarkMindlin_idea
Regular Contributor

@GKmieliauskas thank you for your answer. 

The point is we cannot hit the breakpoint. An addin in not called at all.

We might be missing some setting when designing our workflow step and our addin.

0 Kudos
GKmieliauskas
Esri Regular Contributor

1. Make a copy of your workflow. 

2. Delete all steps in your workflow which goes after your add-in calling and your add-in calling step.

3. Execute your new workflow.

4. Execute your add-in from ArcGIS Pro ribbon by pressing it's button.

0 Kudos
StefanDieters1
Occasional Contributor

I am having a similar issue.

Using the Open Pro Items step under Pro 3.2 Enterprise 11.2 I attempt to run a custom Pro command.

The Open Pro Open step works fine, opening a map, but the command is not run: nothing happens.

I know the add-in command works. I can run it from the ribbon.

The Add-In command is a button with a On Click to trigger its action.

 

Is there some restriction on the type of commands that can be run?

What is supposed to happen?

0 Kudos
MarkMindlin_idea
Regular Contributor

@StefanDieters1 It is solved. I updated the main topic

0 Kudos
StefanDieters1
Occasional Contributor

Thanks in another spot

0 Kudos
StefanDieters1
Occasional Contributor

That's it.

Now have my test addin being run when I Open Pro Project Command.

Thanks

0 Kudos