Workflow Manager run custom ArcGIS Pro command does not work

539
10
Jump to solution
02-06-2024 05:06 PM
StefanDieters1
New Contributor III

Using Workflow Manager on ArcGIS Pro 3.2 Enterprise 11.2

I have created a very simple workflow with following steps : Start, Open Pro Project Items, Stop

Within the Open Pro Project items I open a map then close it on finish. In the advanced section enable Run ArcGIS Pro command with the ID of a button command from a custom add-in.

The ribbon has the custom add-in and the command works from there.

When I run the Job in ArcGIS Pro it works fine opening and then closing the map.

However the command is not run. Just nothing happens.

In the ArcGIUS Server Manager logs I get messages about "received unexpected message() " with source being Workflow manager.

I have tested this only with button commands with an On Click trigger

The add-in was built with Pro 3.2, also tested with add-in built with Pro 3.0

 

Are there limits on the type of custom commands that can be run?

Any other ideas?

1 Solution
10 Replies
MarkMindlin_idea
New Contributor III

Hello Stefan,
We have the same issue and waiting support

0 Kudos
JFarmer
Esri Contributor

Hi @StefanDieters1 @MarkMindlin_idea 

I want to clarify what the expected behavior is here for Workflow Manager.

The Run ArcGIS Pro Command option on the Open Pro Project Items step in Workflow Manager was added so that users could have custom add-ins run when the step runs in Pro. There is no limitation on the custom add-in that can be used so long as it's supported with the version of Pro you are working with (we don't support using out of the box Pro commands with this functionality).

The biggest thing to be aware of is that we are simply running the command when the step runs. Everything else that happens after that point needs to be defined in the command code itself. Meaning, if the command is "show this custom ribbon and this custom button in Pro and wait for user input" then that's what should happen. If the command is "automatically do this work when the command runs" then that's what should happen. If you see different behavior for the command when not using Workflow Manager vs. when you are using Workflow Manager, that would warrant some additional investigation to see what's happening there.

Regarding the unexpected message errors, there will be more information on what the exact issue is there at the Verbose or Debug level in the logs. That should help narrow down if that message is specific to the add-in or something else.

Hope that helps!

Jonathan

0 Kudos
StefanDieters1
New Contributor III

Thanks Jonathan for the clarification,

Your comment "show this custom ribbon and this custom button in Pro and wait for user input" suggests to me that I am missing "the show" part: i.e. have the button appear. It is a simple button on a toolbar My first thought was to change the settings for how the button is loaded in the DAML i.e module autoload="true" and control loadOnClick="false". But no joy. So maybe my question should be

"How do I create a command that displays a  button accepting an on-click response from the user?"

The other thing that might be useful is what is a bit of clarification about how the simple button commands work ... What does the command ID execute: just the on-click method

Thanks

Stefan

0 Kudos
MarkMindlin_idea
New Contributor III

Thank you Jonathan, @JFarmer 

We still need to understand what do you mean when you say "If the command is "automatically do this work when the command runs""
If you could give an example of a such a command it would be beneficial?
What part of the command should contain an actual code which is executing when the command is running? 

0 Kudos
JFarmer
Esri Contributor

Hi @StefanDieters1 @MarkMindlin_idea 

My apologies for the delay in my response, I've been out of the office.

I think part of the issue here is the use of the word "run" on our side. When we say "run", we're simply running the add-in code similar to if you were to run the project in Visual Studio or in Pro itself outside of Workflow Manager https://developers.arcgis.com/documentation/arcgis-add-ins-and-automation/arcgis-pro/tutorials/build...

Anything that happens after that takes place solely within the Pro SDK itself. So, in the case of a simple button like this example (see step 10) https://github.com/esri/arcgis-pro-sdk/wiki/ProGuide-Build-Your-First-Add-in, we'd start running the OnClick method and then Workflow Manager itself is done at that point, whatever happens after is what you've included in your SDK code.

Maybe it would be helpful to understand what you both are looking to accomplish in Workflow Manager? It could be that a custom add-in is best but maybe a custom GP tool or GP service might also work well.

Jonathan

0 Kudos
MarkMindlin_idea
New Contributor III

Thank you Jonathan, @JFarmer 

For example, we need to change the named version of a map layer's data source to default version.

We create an Addin and OnClick method does the change.

Lets compare two options:

1)  The checkbox is not checked

2)  The checkbox is checked and the Command ID filled

MarkMindlin_idea_0-1709079652658.png

At the moment, we do not see the difference in behaviour. Meaning 

1) user must click the Command's button in order to do the change

2) user must click the Command's button in order to do the change

But our expectation for the second option -  piece of Addins C# code executing immediately after the workflow manager step starts, without user click on the Command.

We still try to understand from your explanation, that "run" meaning

1) load (run constructor) on the start
OR
2) make visible the Addin Pane with the Addin
OR 
3) whatever ... 

Please give an example, for what "Run ArcGIS Pro Command" designed?

0 Kudos
StefanDieters1
New Contributor III

Hi Jonathan

Here is what I have set up as a test. Similar to your suggestion.

I have a simple addin created as per ProGuide Build Your first add-in. The button's OnClick method just displays a message. This was built with Visual Studio 2022 under ArcGIS Pro 3.2.

I have created a very simple workflow: Start ---> Open Pro Project Item ---> End. The Open Pro Project just opens a map wthat exists in my Pro project. As part of that I enable Run ArcGIS Pro Command and supply the command ID as found via hovering over the command and in the DAML file as button_refID.

The workflow opens the Pro map fine, but nothing happens with regard to the simple button either as the Open Pro Step is started or finished. As with MarkMaindlin_idea I can open up the addin and click it to see the message. What I am hoping is that the OnClick method is executed from within the workflow. Is this what you mean by "run".

I have experimented with the settings in the DAML file such as autoload, appearsOnAddInTab, loadOnClick, without success. 

Thanks

0 Kudos
JFarmer
Esri Contributor

Thanks @MarkMindlin_idea @StefanDieters1 for working through this.

Looks like we do have a bug here and that has been logged: BUG-000165541. The expected behavior is that the onClick behavior is actually being run when the Open Pro Project step runs and that isn't happening in testing on our side (or for you as you found out).

We're working on addressing this but I don't have a set Pro release where this will be fixed as of yet. We will also discuss patch options for this as well.

Thanks,

Jonathan

MarkMindlin_idea
New Contributor III

Many thanks Jonathan, @JFarmer 

0 Kudos