// Get the Message that precedes this Script. var msg = $context.currentItem.previousItem; // Get the response to the Message. var response = msg.getResponse(msg.RESPONSE_HTTP_BODY); // Was there a response? if (response == null) { // There was no response. // Output an informational message. $context.result.postMessage($context.result.LEVEL_INFO, "Message " + msg.name + " received no response to validate."); } else { // There was a response. // Get the value of the Global Property. // var stringToFind = $globalprop.value("Global property list name here", "Global property name here"); // string to find; hard coded var stringToFind = "seeing this error because you have"; // Determine if the value exists in the response. var searchIndex = response.indexOf(stringToFind); // If the value does exist in the response, output an error. if (searchIndex > -1) { var details = "Response:\n" + response + "\n\nValue searched for:\n" + stringToFind; $context.result.postMessage($context.result.LEVEL_ERROR, "Error found in response to Message " + msg.name, details); } } msg.clearResponse();