cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Get informationen from Davis problem trigger

Marius_Hell
Frequent Guest

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

2 REPLIES 2

ChristopherHejl
Dynatrace Helper
Dynatrace Helper

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

ChristopherHejl_0-1718269755793.png

But you could also use it directly in other tasks in the input using expression, eg in the http request like this

ChristopherHejl_1-1718269786311.png

ChristopherHejl_2-1718269795076.png

 

 

Marius_Hell
Frequent Guest

Thank you for your fast solution. Especially the second solutions is more efficient than the intended way from me.

Featured Posts