reponse scriptlet string method unavailable

I got this scriptlet:

var myresults = new String();
var myresults = scriptletContext.get("results");
var resp = myresults.includes("True");
if ( resp ){
 scriptletResponse = "success";
else {
 scriptletResponse = "failure";

I'm trying to evaluate the response I get from an operation a string "True" or "False" ( that is filtered out of a XML response)

and I always get this error, the erro is always when using .includes() , it seems that the method is available.

I either need it to work or something that does the same ( return true/false when comparing 2 strings)

2017-12-20 13:17:57,332 ERROR    EventDrivenDebugger.updateHaltedStatusBar:1838    com.iconclude.dharma.runengine.RunException: Scriptlet error at line 3.
Code: var resp = myresults.includes("True");
Details: TypeError: Cannot read property "includes" from undefined in <eval> at line number 3

  • Verified Answer

    If you are wanting to test the var myresults for "True" (case sensitive)
    Try this:

    myresults = scriptletContext.get("results");
    resp = /True/.test(myresults); //tests the value of myresults for 'True' case sensitive

    if (resp) {
     scriptletResponse = "success";
    else {
     scriptletResponse = "failure";

  • Thank you Walt,

    It worked like a charm!

    I'd still like to know what is and what is not available with the scriptlet compare to NodeJS.

    Is there more detail references on OO scriplet? Usualy HP was good at providing references for APIs, formal references.

    Thanks again!



Reply Children