I have below code where if statement that needs to work based on 'check' boolean value, is not working properly.
Although, 'check' value is true it navigates to the else block. Can someone please let me know why this is happening?
Code
{!REQUIRESCRIPT("/soap/ajax/10.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/10.0/apex.js")}
var user = sforce.connection.getUserInfo();
var check=false;
check=sforce.apex.execute("CheckAOCAccess","AOCAccess",{LoggedUser:"{!User.Id}"});
alert('check@'+check);
var vUrl = '/apex/ABV_AoCSignatureCapturOnline?actId={!Account.Id}';
if(check==true){ // This line fails to work based on check value
alert('check@1'+check); window.open(vUrl);
}
else {//Everytime else block is fired
alert('check@2'+check);
alert('You are have not the privilege for Acknowledgement of Contents!');
}