I'm having a little bit of difficulty working with Workflow Manager from the Pro .NET SDK. I would really like to be able to create and continue jobs from my custom add-in, but what I have right now is not working. I'm wondering if I am misunderstanding the meaning of certain functions.
Here's a snippet of code that I've been using, which I believe is in the documentation, that I thought would allow me to continue a Job from the current step:
var jobManager = WorkflowClientModule.JobsManager;
jobManager.RunSteps(jobId);
I am connected to Workflow Manager when I run this inside a button command, I have a valid job ID, but when I run it... nothing. No errors or any response from Pro itself. What I expected was something similar to clicking the "Resume" button here in the UI in Pro:
Is there some other way to get the same functionality? Thank you in advance. 🙂
Edit: Additionally, is it possible to create a job from the SDK?
Hi,
For now, my answer to your additionally question is it possible to create a job from the SDK. Yes, it is possible. There is CreateNewJob method from JobsManager.
// CreateJob returns an ID of a new job
// it is a passed a valid job type ID as an integer
var wfCon = await WorkflowModule.ConnectAsync();
var jobManager = wfCon.GetManager<JobsManager>();
var jobID = jobManager.CreateNewJob(jobTypeID);
Hi, thank you for your response.
My understanding is this function is from the Workflow Manager (Classic) Assembly, ArcGIS.Desktop.Workflow, as opposed to the Workflow Manager Assembly, ArcGIS.Desktop.Workflow.Client. I want to do this in the modern workflow manager. Are these namespaces cross-compatible?
You are right. JobsManager belongs to ArcGIS.Desktop.Workflow.Models namespace. Overview of name namespace states: "The ArcGIS.Desktop.Workflow.Models provides access to retrieving jobs and configuration information from the Workflow Manager Classic database.". I don't know about compatibility.
@GfreitagYes you should be able to run jobs in Workflow Manager by calling the RunSteps method in JobsManager as you have in your code. However, I noticed the step you're trying to run is a Define Location step which requires user interactions. The reason you're seeing the Resume button on the job card is because your Add-In initiated the run step call rather than being initiated in the Workflow Pane. It's a similar experience as when you run the step in the Workflow Manager web app, then view the same job in Pro. Steps run from an Add-In (which is essentially another client) that requires user interactions will need to be resumed in the Workflow Pane job card. Steps not requiring user interactions will just run.
To answer your other question, we do not currently expose the ability to create jobs in Workflow Manager via the Pro SDK. You can create jobs using REST and Python APIs. However, this is definitely good feedback which I will bring back to the team.
Also to clarify, the ArcGIS.Desktop.Workflow.Client and ArcGIS.Desktop.Workflow (Classic) assemblies run on different platforms and are not compatible. The Classic product is deprecated.
Hope this helps.
Workflow Manager Team
Thank you for the detailed response @LalaineLam ! That does clear things up for me significantly.