11 Jul 2024 11:10 AM - last edited on 12 Jul 2024 02:52 PM by MaciejNeumann
Hello,
In my workflow, I have a previous http request task with the following result :
I tried to use the value of "name" on the next task (http request) without success :
{
"eventType": "CUSTOM_INFO",
"title": "Loadtest start",
"timeout": 30,
"entitySelector": "type(APPLICATION),entityName.equals(XXXXXX)",
"properties": {
"Tool": "Octoperf",
"Load per minute": "100",
"Scenario name": "{{ result("launch_XXXXXXX_test2")["name"] }}"
}
}
I also tried with success :
"Scenario name": "{{ result("launch_XXXXXXX_test2")["json"]["name"] }}"
The error encountered is :
Could you help me how to get the right value from a task result ?
Thank you for your support.
Regards Aurélien
Solved! Go to Solution.
11 Jul 2024 01:46 PM
I solve it by using :
"Scenario name": "{{ result('launch_XXXX_test2').json.name }}"
11 Jul 2024 02:59 PM
But I don't find how to extract the name value with a custom JS task :
I encounter the exception below :
An error of type UNCAUGHT_EXCEPTION occurred in line 8 (col 39) " const name = await checkResult.json.name;": TypeError: Cannot read properties of undefined (reading 'name')
at default (file:///script.ts:8:39)
at eventLoopTick (ext:core/01_core.js:169:7)
Thank you.
11 Jul 2024 04:55 PM
Solved too !
// import of sdk modules
import { execution } from '@dynatrace-sdk/automation-utils';
export default async function ({ execution_id }) {
const exe = await execution(execution_id);
const checkResult = await exe.result('launch_xxxxx_test');
const json = checkResult['json'];
console.log('name : ', json.name);
console.log('id : ', json.benchResultIds[0]);
}
17 Aug 2024 09:09 PM - edited 17 Aug 2024 10:05 PM
Can you help me on my thread.
And also I don't know why I'm seeing different output for my HTTP request.
Your output,
My output,
Regards,
AK
19 Aug 2024 12:03 PM
Hello @AK
I think you found it by yourself.
However, based on my previous comment, I would have done it like this. :
// optional import of sdk modules
import { execution } from '@dynatrace-sdk/automation-utils';
export default async function({execution_id}) {
const ex = await execution(execution_id);
const data = await ex.result('check_rum_version');
const json = data['0'];
console.log('appId : ', json.scope);
}
Which "check_rum_version" is the name of the step corresponding to the http call.
Regards