I want to check the validity of input parameters by doing a REST call to the service. I need to check if the credentials are correct and can be used before action is deployed.
Currently I am trying to use XMLHttpRequest for REST calls in the CustomValidator function. But I am getting the given error.
Is there a way I can do a rest call from fixlet before deploying it?
example code for my validator:
validateConn : function (validationObj) {
var currentValue = validationObj["currentValue"];
var mykey = FixletUtils.getElementValue("mykey");
var xmlhttp;
var myheader = "myKey=" + mykey + "; secret=" + currentValue;
xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status != 200) {
return "Nope";
}
};
xmlhttp.open("GET", "...", false);
xmlhttp.setRequestHeader("myheader", myheader);
xmlhttp.send(null);
}