# Name: SetTaskList_sample.py
# Description: This script sets the task list on a workflow and creates records based on the workflow type
# Import System Modules
import arcpy
# Check Out Extensions
arcpy.CheckOutExtension('Foundation')
arcpy.CheckOutExtension('JTX')
# Setting the environment
arcpy.env.overwriteOutput = True
# Setting Local Variables
job_id = 1025
input_database_connection = r'C:\Data\Workflows\Testing.jtc'
# Calling the Set Task List tool to create records for the data production tasks on the Extract Task Group job
arcpy.topographic.SetTaskList(job_id, input_database_connection)
# Getting all messages, warnings, and errors from the tool run and printing the results back to the user
messages = arcpy.GetMessages(0)
warnings = arcpy.GetMessages(1)
errors = arcpy.GetMessages(2)
arcpy.AddMessage('Tool Messages: {}\nTool Warnings: {}\nTool Errors{}\n'.format(messages, warnings, errors))
# Check In Extensions
arcpy.CheckInExtension('Foundation')
arcpy.CheckInExtension('JTX')