[Help] Access Data Repository Data Source from A Message Responder Script

awallsawalls Posts: 15
edited September 2020 in Virtualize


I'm trying to access values inside of a data repository on a Message Responder script. I have "use data source" checkbox checked.

Code Below:

import com.parasoft.api.*;

def messageResponderResponse(context) {
    String dataRepoVal = context.getValue("root Data 2","AccountNumber");
    Application.showMessage("DEBUG VALUE: " + dataRepoVal);

    return dataRepoVal;

This is where I'm doing the scripting:



  • williammccuskerwilliammccusker Posts: 528 ✭✭✭


    Why are you trying to access the value in the data repository? Are you wanting to transform the value from the repository for that field in some way? If that is the case I would suggest parameterizing the response message as normal, data banking the value from the outgoing response then using a transform, possibly with a script, to read the value from the data bank.

    The reason I would suggest that is because the data repository is a complicated structure and navigating it involves a lot of knowledge of internal API and classes.

  • awallsawalls Posts: 15

    Hi William,

    My goal is to:
    1. Check if there is a value inside of the data repository
    2. If There is, just send that value that's inside of the data repo
    3. If not, Use the randomly generated value from my Data Generation tool and send that in the response

  • williammccuskerwilliammccusker Posts: 528 ✭✭✭


    What about using an extension tool chained to the outgoing response and doing a string replace? The script could either look for a specific "default" or "replace" value or it could look for the field tag with a specific value, say null. Then replace that with a desired value. I attached a simple example.

Sign In or Register to comment.