Apologies in advance as this question could fit in many different sections on the board, but hopefully someone will understand what I'm asking here! I need to be able to access our web GIS through a published geoprocessing service to pull down layers that were shared from the new Field Maps application (namely, I need to get markup layers). I have a web map that was built using the Javascript API and I'm envisioning a button to run the geoprocessing service as I do with so many others. Here's the workflow I need:
1) Click button on web map built with ArcGIS API for Javascript
2) It runs a geoprocessing service on the server. This geoprocessing service contains the arcgis module.
3) arcgis module logs into AGOL or Portal (I haven't figured it out yet), navigates to a group, and pulls down the markup layers. I will then use arcpy to manipulate them how I want (inside the same script) and then send an email to the user with the resulting FGB in a zip file.
I have many geoprocessing services running arcpy scripts when a button is clicked on the web map built with JS, but I'm unsure if the arcgis module can be run on the server (ArcGIS Enterprise 10.7). Has anybody successfully done something like this?