Summary
The Citizen Problem Reporter solution comes with a Python toolbox called "Service Functions" that contains five tools (listed below). These tools enable users to extend the solution and automate the following processes:
- Define Connection Settings
- Enrich reports
- Generate (report) IDs
- Moderate reports
- Send email notifications
To use any of the tools, it is necessary to define the connection to the portal where the solution is hosted.
Procedure
To configure the solution with the send email notification tool, follow the steps below:
- Open ArcGIS Pro.
- From the Catalog pane, right-click Toolboxes > Add Toolbox, as shown in the image below
- Browse to the following URL, download ServiceSupport.zip, and add the ServiceSupport.pyt toolbox extracted from the zip file.
http://links.esri.com/download/servicefunctions/
- Expand the ServiceSupport.pyt toolbox, and double-click Define Connection Settings, as shown in the next image.
- In the Define Connection Settings dialog, under Add ArcGIS Online organization or ArcGIS Enterprise portal URL, add the organization URL.
- Add your Username and Password, and click Run.
- Under the ServiceSupport.pyt toolbox, double-click the Send Emails tool, as shown in the next image.
- In the Send Emails dialog, shown in the next image, under Layer, browse for the Citizen Problems layer.
- Configure other Email Settings as needed:
- Under General Email Settings add the SMTP Server
- Add the SMTP Username and SMTP Password (This is not required if authenticating through a port)
- Fill out From Address and Reply Address
- Enable Use TLS
- Click Run.
- After configuring the email notification tool, email notification is not automatically sent once a report is submitted through the app. Rather, you must run the servicefunctions.py script.
- This can be automated by running the script using Windows Task Scheduler.
Sometimes, running the script may return errors, similar to the following, and as shown in the image below, however the script successfully triggers email notifications:
ERROR: Failed to process service <service url>
You do not have permissions to access this resource or perform this operation.
(Error Code 403)