18 Aug 2025 10:37 AM
Hello,
We're trying to do something with records which have been open for a period of time.
So I've created a workflow with (for now: ) 2 steps:
The problem I seem to face is: the array I get from DQL seems to be an object, but all records within are treated as strings
the code:
// optional import of sdk modules
import { execution } from '@dynatrace-sdk/automation-utils';
export default async function ({ execution_id }) {
// your code goes here
// e.g. get the current execution
console.log("wait for log running problems");
const exe = await execution(execution_id);
const problems_array = await exe.result("fetch_long_running_problems")
console.log("problems_data: " + typeof(problems_array));
//console.log(problems_array);
for (const problem_record in problems_array.records) {
console.log("* (" + typeof(problem_record) + ") : " + problem_record);
}
// not yet important for now
return { problems_array };
}
a snippet from the JSON I get:
[
{
timestamp: "2025-08-18T03:08:03.345000000Z",
display_id: "P-25085838",
"event.name": "Process unavailable",
entity_tags: [
"Application:XXX",
"Environment:400DEV",
"ExeName:RI.demo.B*B.Sif.Signal*L.Daemons.Dispatcher.exe",
"HostName:servername",
"Process Group Availability Monitored:true",
"ProcessType:Daemon"
],
"event.description": "# Process unavailable\n" +
"\n" +
"The problem **affects 1 entity** overall.\n"
},
{
timestamp: "2025-08-18T07:44:47.835000000Z",
display_id: "P-25086167",
"event.name": "RI - PENORCH - demo NServiceBus Handlers Service is in undesirable (stopped) state",
entity_tags: [
"Application:XXX",
"Environment:200REL",
"HostName:server-url"
],
"event.description": "# RI - PENORCH - demo NServiceBus Handlers Service is in undesirable (stopped) state\n" +
"\n" +
"The problem **affects 1 entity** overall.\n"
},
{
timestamp: "2025-08-18T03:42:14.394000000Z",
display_id: "P-25086104",
"event.name": "200REL - NSB errors for NPR.B2Bdemo",
entity_tags: [ "Environment:200REL", "Queues:NServiceBus", "Team:XXX" ],
"event.description": "# 200REL - NSB errors for NPR.B2Bdemo\n" +
"\n" +
"The problem **affects 1 entity** overall.\n"
},
{
timestamp: "2025-08-18T08:50:23.818000000Z",
display_id: "P-25086103",
"event.name": "200REL - NSB errors for NPR.demo_SubNotifications",
entity_tags: [ "Environment:200REL", "Queues:NServiceBus", "Team:XXX" ],
"event.description": "# 200REL - NSB errors for NPR.demo_SubNotifications\n" +
"\n" +
"The problem **affects 1 entity** overall.\n"
}
]
... but the output I get for now is:
wait for log running problems
problems_data: object
* (string) : 0
* (string) : 1
* (string) : 2
* (string) : 3
* (string) : 4
* (string) : 5
* (string) : 6
* (string) : 7
* (string) : 8
Could someone give a hint how to tackle this?
Thanks,
Jan