Create jobs per array item

445
3
08-22-2023 06:52 PM
Hector_Melendez
New Contributor II

Using ArcGIS Online Workflow Manager Advance,  I'm trying to schedule a job that sends a web request to a feature service to get all new records and then creates individual jobs for each new record using create jobs per array

Is there a way of passing the job properties in the array so that each job has some details in it rather than the template defaults?

Failing that is there a way to model a for-in-loop in the scheduled jobs so that I can create each job individually, set its property and then move to the next item in the array creating each job and setting its property one at a time?

0 Kudos
3 Replies
SamWest1
Esri Contributor

Hi Hector, it is possible to pass an array of details for each job you wish to create. This could be an array of json objects or an array of arrays containing the details you wish to update. Your best bet will be to use Create Job per Array like you mentioned to create a job for each change, and then as preprocessing for each of those jobs, update the corresponding job or extended properties using Arcade expressions for the output values with the Update Job Properties step.

If you're using the Extract Changes endpoint, and there's anything you aren't able to include from that response, it may be worth querying the feature service as well in each job for those additional details based on the object ids with changes. If there's any information in the scheduled job that you wish to be accessible within the newly created jobs, you can also make use of the parent-child relationship to pull that information. Hopefully this helps get you on track, but if you need further support be sure to let us know.

For anyone at 11.1 and using either a hosted feature service or non-versioned referenced feature service this process is a bit easier. We have introduced the ability to create jobs with feature service webhooks that should cover this use case without needing a scheduled web request. This blog helps outline how to get started with those: Using the Feature Service Webhook Extract Changes Option in ArcGIS Workflow Manager

0 Kudos
Hector_Melendez
New Contributor II

I thought of using parent-child relationship in combination with Update Job Property but the problem that I encounter is that my schedule job creates many jobs but they all have the same default template properties. I'm not able to pass at least an ObjectID of the feature that the jobs is for so that I can query the feature properties to populate the job. @SamWest1 

Is there a json schema that I can pass to the create jobs per array so that each job has a unique name or description (e.g. the feature objectID)? Then with that unique name or description, I can get the rest of the properties on each job.

0 Kudos
SamWest1
Esri Contributor

Unfortunately there is not a way to pass a schema in to the array and have the system process it for you, however that is a neat use case that I'll pass on to the rest of the team for consideration. You'll have to handle that preprocessing of the array yourself with either a Send Web Request step to update the job or by updating each of those properties with the Update Job Properties step. You could also override the defaults through our other APIs such as REST and Python when creating the jobs, but that would require more customization.

0 Kudos