Hi,
I have a requirement where a validation is to be done(execute a API) after user clicks Ctrl+35 in related options. The script should throw a error message if the validation is false and should not navigate to the next panel and If the validation is true we should be able to navigate to the next panel.
I have used the following code to stop the navigation but the issue is if the validation is true it is not going to the next panel
Lease_STS201_checkbox_E.prototype.onRequesting =function(args) {
if (args.commandType == "LSTOPT" && (args.commandValue == "35")){
args.cancel=true;
debugger;
Grid = args.controller.ActiveGrid;
Gridlist = Grid.getData().getItems();
selectedRows = Grid.getSelectedRows();
_file="STAGLI";
_pko1=document.getElementById("WBAGNB").value;
_pko2=0;
_pko3=Gridlist[selectedRows[0]]["C2"];
var getFieldValueReqGet = new MIRequest();
getFieldValueReqGet.program = "CUSEXTMI";
getFieldValueReqGet.transaction = "GetFieldValueEx";
getFieldValueReqGet.includeMetadata = true;
getFieldValueReqGet.outputFields = ["CHB1","CHB3"];
getFieldValueReqGet.record = {
FILE:_file,
PK01:_pko1,
PK02:_pko2,
PK03:_pko3
};
MIService.Current.executeRequest(getFieldValueReqGet).then(function(getFieldValueResGet) {
if (getFieldValueResGet.items.length > 0) {
_CHB1=getFieldValueResGet.item.CHB1;
_CHB3=getFieldValueResGet.item.CHB3;
if (_CHB1==1 && _CHB3==0){
args.cancel=false;
Lease_STS201_checkbox_E.showConfirmDialog("Warning", "stop");
console.log("stop");
}
}
}).catch(function(getFieldValueResGet) {
console.log("error",getFieldValueResGet);
});
}
Can you suggest how I can achieve this functionality.