Working with custom script tools, embedded toolboxes, and tasks in project templates

163
1
Jump to solution
2 weeks ago
MarieLandis1
New Contributor III

Are there best practices available for a deploying a ArcGIS Pro project template (.aptx), shared via AGOL, that includes tasks and a script tool, where one of the tasks opens the script tool? In this case, the tool creates a geodatabase with custom feature classes and domains, and the user provides a default coordinate system and a few of the default attribute values. Here are the challenges I have:

1. The script/toolbox location shifts when publishing my .arpx as an .aptx, and this causes an error in the task step that automatically opens the tool. Although the script was stored in my default toolbox in my .arpx (options are set to create a new default toolbox when starting a new project), this location would get lost to the task when another user opens a project with the template. My workaround was to duplicate the script in another toolbox and add that toolbox to the project before sharing as a template. This step has resulted in a second issue:

2. In the template publishing process, the script itself is modified. The beginning of the script now includes a bunch of ESRI variables that I did not add. This "ESRI_variable_4" is especially problematic and is causing the tool to fail. 

MarieLandis1_0-1715005879790.png

Questions:

Why are the ESRI variables added?

Is there a way to include a toolbox in a template that a) maintains a Task's reference to the script tool and b) doesn't involve including an unnecessary copy of the original project's default toolbox?

How can I prevent the template creation process from altering a custom script tool built in to the template?

ArcGIS Pro 3.2.2

 

Edit: The script tool does set many string variables, and is behaving an awful lot like this closed bug for Pro 1.1 is described.
BUG-000088621 for ArcGIS Pro (esri.com)

1 Solution

Accepted Solutions
MarieLandis1
New Contributor III

Reigned in the altered script by changing all the filepath-related variables to string variables, per Error: 00068: Script Contains Broken Project Data Source (esri.com).

View solution in original post

0 Kudos
1 Reply
MarieLandis1
New Contributor III

Reigned in the altered script by changing all the filepath-related variables to string variables, per Error: 00068: Script Contains Broken Project Data Source (esri.com).

0 Kudos