Print Popups

608
3
05-07-2018 11:42 AM
michael_vetter
Occasional Contributor

Hi,

I'm trying to create a custom print service that allows a user to select points and then have a PDF created that displays attributes from the selected points.

I've looked over this blog post about how to accomplish this task. I was able to accomplish option #1 from the blog post, but it isn't really acceptable. I downloaded the sample code from the post and ran the script. The script runs and I'm able to create geoprocessing service from the result. However, when I try to use geoprocessing service in web appbuilder, I get an error saying that the url is invalid.

Any ideas as to why the error message is saying that the url is invalid? Does anybody have some sample code to show how they achieved this task?

Any help would be appreciated!

Thanks in advance!

0 Kudos
3 Replies
TanuHoque
Esri Regular Contributor

Michael, 

My apologies as I couldn't get back to you earlier.

it seems like you ran into this bug 

BUG-000114154 - Print Widget fails to load/connect ArcPy print service without optional parameters

There is a simple workaround though: 

- while you are creating the arcpy script tool, you need to add the following two optional parameters to match its signature to the out of the box print service's signature

      Format
      Layout_Template

 - the values in that list are not important here - therefore you can get away with only one value for each of these parameters.

Apparently the bug in the WAB print widget makes it think the print service is not valid when those two optional parameters are missing.

one other thing: I understand you have your WAB app are running on 10.5.1 enterprise environment.That is good.

Apparently there was an optimization made in JS API Print task in 3.21 release that strips off all attributes from all layers in the webmap_as_json - and since the popup/report arcpy script relies on these attributes, when they are missing, you won't see attributes showing up in the print output.

The issue in JS API Print task got fixed in 3.24 where you can ask to include attributes optionally. Unfortunately 10.6 enterprise does not include 3.24.

pls let me know if you have any question.

Thanks.

Tanu

michael_vetter
Occasional Contributor

Tanu,

Thanks for the reply. If I were to use the popup/report arcpy script in WAB, is there a way to make sure the forceFeatureAttribute option of the print template is set to true? Or should this script be primarily be used in a custom JS application?

Thanks,

Michael

0 Kudos
TanuHoque
Esri Regular Contributor

Michael,

I'm novice when it comes to WAB widgets  my understanding is that WAB widgets heavily, if not entirely, relies on JS API functionality - if the version of JS API, that is installed as part of your ArcGIS Enterprise/portal install, is not one of those I have mentioned earlier, then you are out of luck since forceAttributes is not supported in those JS API versions.

here is my take:

  • if you are using 10.5.1 or earlier version of ArcGIS Enterprise/portal, then you are all good - all you need to do is to update your arcpy based print service with those optional parameters.
  • if you have already moved to 10.6 ArcGIS Enterprise/portal, then a custom JS API based web app appears to be a viable solution.
  • if you are using WAB off agol, then I need to research to find out what can be done - as you know agol is updated with JS API 3.24 as part of its latest release.

Having said that, we are working on making this issue go away, I will update this thread as enhancements are made available as part of new releases.

looped in Jianxia Song‌ in case she has additional info to add or I made any erroneous claim(s) here.

Thanks.

Tanu

0 Kudos