Workiva Scripting provides a flexible, secure environment for running Python code on the Workiva platform. This article covers some of the more common scenarios you may encounter while building your script.
Workiva Scripting is included with Customize Workiva. To use Scripting, your workspace must have Customize Workiva/Scripting enabled, and users will need the appropriate Scripting role(s) and file permissions.
For issues not covered here, check out our other Workiva Scripting articles or visit the Workiva APIs and Workiva Scripting communities.
Admin and permission issues
Execute Script action does not appear in Automations
This indicates you do not have the role needed to execute this script. Contact your Workspace Admin to assign an appropriate Scripting role.
If a required role is assigned and the action is still not available, please verify that the scripting feature is enabled in that particular workspace.
Workiva Scripting connector not available in Chains
This indicates that the Workiva Scripting connector has not been enabled for your workspace. If you believe it should be enabled and it isn't, contact your Workiva account team.
No scripting roles are visible to the Workspace Administrator
This indicates that the scripting feature has not been enabled for your workspace. If you believe it should be enabled and it isn't, contact your Workiva account team.
Workiva Scripting connector and command issues (chains)
Command execution starts but script execution does not
Verify that the scripting feature has been enabled for your workspace. If you believe it should be enabled and it isn't, contact your Workiva account team.
If you've confirmed that scripting is enabled, then the integration user for the Workiva Scripting connector may not have the necessary role assigned. Contact your Workspace Admin to assign an appropriate Scripting role. You should also verify that the integration user has permission to access the script fired by the command.
Command execution is still in progress but script execution stops unexpectedly
Please verify that the script execution was not cancelled outside of this command. Run history can be found in the Properties panel of the scripting editor or retrieved via the Scripting Prototype API endpoints.
If that is not the issue, please make sure that the script execution has not reached the max allowed RAM usage (see Workiva Scripting Limits). You can do this by reporting memory usage in your code.
We've included an example below of how to report memory usage with tracemalloc from the Python standard library.
# importing the module
import tracemalloc
# code or function for which memory
# has to be monitored
def app():
lt = []
for i in range(0, 100000):
lt.append(i)
# starting the monitoring
tracemalloc.start()
# function call
app()
# displaying the memory
print(tracemalloc.get_traced_memory())
# stopping the library
tracemalloc.stop()Script executions also have a max runtime (see Workiva Scripting Limits); please make sure that the script execution has not reached this limit.
Lastly, verify that the script code does not include the following functions:
- quit()
- exit()
- sys.exit()
- os._exit()
These functions have almost the same functionality to raise the SystemExit exception by which the Python interpreter exits.
Command and script execution out of sync
This occurs when the command completes and the script run keeps going, or vice versa.
If the command completes before the script execution, please make sure that the command timeout is greater than the script execution time (see Workiva Scripting Limits to learn about the max script execution time).
If the script execution completes mere seconds before the command, this may be an expected delay caused by the Scripting system processing information after the script execution is completed. The Command will only report completion once the whole process is finished.
Scripting editor
Import a library does not work
Workiva Scripting supports Python's standard library out-of-the-box, as well as components available from the Python Package Index (see Supported Workiva Scripting libraries and dependencies for more information). PyPI components that require additional installations may not be supported.
Please make sure that the library you are trying to import is part of the Python's standard library or the Python Package Index. If it is a component of the latter, make sure that no additional installations are required.