The function simply returns the transaction response time. See below:
The function is placed in EvalJS Step and calling it after the END transaction. See below:
When I run this script, I get an error unknown function getResponseTime() - which is expected.
Can someone let me know what is the correct way of calling this function to return me the response time value.
My original idea is - at step 24 - my java script code wiill make an entry into influx db with the above response time
I do not see an issue with your java script. I can simulate your function definition and call. At which LR version are you, I'm at 12.55.
But your logic needs improvement. You can call TC.transactionDuration() only on an open transaction and not after end-transaction.
Reward community members who take time to respond and help.
@JHF Remmelzwaal is right. You need to call the function from within the context of the transaction and not after it ended.
In addition, the function definition as you defined it will not be recongnized by other steps. Instead, I suggest using a function inside a TruClient function library. That will be a more appropriate way to use.