- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-07-2025 09:10 PM
Hi Everyone,
I’m building a Gen AI Agent in ServiceNow that uses a Script Tool to extract and return values like extracted_text. The tool executes successfully, and I see a proper return from the script like this:
However, in the Agent Execution Logs, the output is coming through as empty
{"extracted_text":{}}
What I've Checked:
The Script runs successfully and returns the expected object.
The Display Output checkbox is enabled on the tool.
My tool is linked via Agent Tool [sn_aia_agent_tool_m2m] to the skill.
I'm working in the global scope.
The field Tool Outputs is also not visible to manually define the output keys.
My Main Question:
How are other out-of-box AI Agent tools able to populate outputs, and can I manually define Tool Outputs for a custom Script Tool?
Do I need to:
Activate a plugin?
Switch to a specific scope?
Add related lists manually?
- Or anything else
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-26-2025 07:51 AM
I was able to identify the issue. Although the script executed successfully, it was returning text that contained special characters (such as newlines and carriage returns), which caused the return statement to fail. I resolved this by using JavaScript regular expressions to replace the special characters, and it worked as expected.
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-09-2025 08:57 AM
@stevenatwork - It would be helpful if you add few screenshots to this post.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-26-2025 07:51 AM
I was able to identify the issue. Although the script executed successfully, it was returning text that contained special characters (such as newlines and carriage returns), which caused the return statement to fail. I resolved this by using JavaScript regular expressions to replace the special characters, and it worked as expected.
Thank you.