Enter Case number reference for associated cases.

Case #

Type: APM as a Service

Include any information that is for INTERNAL use only

Information:

Detail the contextual information specific to the issue; i.e. Product, Version, Agent, System, etc.

  • Dynatrace Recorder

 

Describe the problem, from the user perspective

I want to get a specific object reply content for further use in a script. For example, I need to get the object reply content and grab the dynamic value in the source then use it in later steps. How can I do it?

Clearly list the Steps to resolve the issue

Use a Custom action in the Dynatrace Recorder to implement this.

Add the Custom action at the beginning of the step where the specific object will be downloaded.

In the indexOf() function, specify the object that you want to capture the reply content.

The example code below captures the object whose URL contains UsernameToken.

For more information, see the help pages Custom actions and Editing Script Actions.

var send = new AddEventHookCommand( 
{ 
"eventType": "replyReceived", 
"name": "replyReceived", 
"handler":
 "if(response.getRequest().getUrl().indexOf('UsernameToken') != -1){var 
con = response.content;var contentBytes = response.contentBytes; for(var
 i in contentBytes){con += String.fromCharCode(contentBytes[i]);} 
alert(con);}" 
// con is the content of this object 
}); 
send.execute();