Select to view content in your preferred language

Add warning note at the top of a custom geoprocessing tool in ArcGIS Pro

419
4
10-07-2024 06:54 AM
Clubdebambos
Frequent Contributor

Is it possible to add notes at the top of custom tools, either with Python or the Toolbox GUI, similar to what I see here for the Append tool where it says "This tool modifies the Target Dataset"

I want to add a customised note of my own at the top of a custom tool.

Clubdebambos_0-1728309105164.png

 

~ learn.finaldraftmapping.com
4 Replies
DuncanHornby
MVP Notable Contributor

I don't believe that blue message area is exposed to arcpy. Or if it is, it is an undocumented capability. May be in some future release ESRI will allow developers to put a piece of text into it?

What you can do is validate on each parameter of a python script tool you are building. So you could for example check if an input layer has a specific field, if it does not then you return an error message and the tool will not be allow to run. This ensures all parameters are valid for the code they are about to feed into.

 

HaydenWelch
Frequent Contributor

As @DuncanHornby said, you can put the message on parameters:

HaydenWelch_0-1729185596423.png

 

you can do this in the updateMessages function of a pyt tool:

...
def updateMessages(self, parameters: list[arcpy.Parameter]) -> None:
    parameters[0].setWarningMessage("Warning message")
...
0 Kudos
Clubdebambos
Frequent Contributor

Thanks @DuncanHornby and @HaydenWelch,

Its not what I want to do. It would be nice to be able to add that blue tip at the top that states a tool will modify the input/target dataset in place without an Add Warning workaround.

Cheers

~ learn.finaldraftmapping.com
HaydenWelch
Frequent Contributor

In that case definitely put something in the Ideas board. Because that isn't currently possible with Arcpy, having that specific behavior would need to be added in a new release. For now you'd just have to use the workaround for similar functionality.