13 Jun 2024
09:00 AM
- last edited on
30 Mar 2026
07:57 AM
by
MaciejNeumann
Hi community,
i would like to send problem information to our to ticket system, to inform our customer. Important for this worklfow is the information, which entity is reporting. We send the information to the teams in dependency of the entity.
Unfortunatly the object in the worklfow "Davis problem trigger" only has the information of the affected entity as Id like this ["HOST-B800B96861849859"]. For this reason, i can't send a http-request to the entity, because it isn't the matching https format. (I know the parameter "affected entity id" is not the best, but first i would like to work with that.)
So i have to customize the information in a java script object.
Placeholder like {{...}} are not working in Java script. So we tried this script to get the informatione from the object "Davis problem trigger"
---------------------------------------------------------------------
import { execution } from '@dynatrace-sdk/automation-utils';
const previousTaskName = 'Davis problem trigger
export default async function ({ execution_id })
{
var exe = await execution(execution_id);
console.log(execution_id);
var task_result = await exe.result(previousTaskName);
console.log(task_result);
var records = task_result['records'];
console.log(records);
}
--------------------------------------------------
The output from this script says, that there is no matching object with this id. I checked this information, and saw, that die Id from the object "Davis problem trigger" matched with the id, which ist not found from the script.
Now I have no idea what to do next. I didn't found any solutions in the documentation and Community.
Can you help me? Are my thoughts to get this information to complicated?
I`m looking forward to your answers!
Regards
Marius
Solved! Go to Solution.
13 Jun 2024 10:10 AM
You can grab the event payload for event-triggered workflows from the execution params like this
import { execution } from '@dynatrace-sdk/automation-utils';
export default async function ({ execution_id }) {
// your code goes here
// e.g. get the current execution
const ex = await execution(execution_id);
const problem_event = ex.params.event
console.log('Affected entity IDs', problem_event.affected_entity_ids);
}
Which would have a result like this
But you could also use it directly in other tasks in the input using expression, eg in the http request like this
13 Jun 2024 12:54 PM
Thank you for your fast solution. Especially the second solutions is more efficient than the intended way from me.
27 Mar 2026 12:36 PM - edited 27 Mar 2026 12:37 PM
Hi,
let me bring up this again.
It seems to work with fields that have _ as seperator. But how does that work with fields that have . ?
like event.id or host.name
I tried it like this:
problem_url : environmentUrl + '/ui/apps/dynatrace.davis.problems/problem/' + problem_event.event.idBut I get the message:
An error of type UNCAUGHT_EXCEPTION occurred in line 15 (col 108) " problem_url : environmentUrl + '/ui/apps/dynatrace.davis.problems/problem/' + problem_event.event.id,": TypeError: Cannot read properties of undefined (reading 'id')
problem_event in my case is a const of ex.params.event.
27 Mar 2026 12:44 PM
found it:
problem_url : environmentUrl + '/ui/apps/dynatrace.davis.problems/problem/' + problem_event['event.id'],
Featured Posts