1
I have a screen where you have the service order states, when that service order is 86, it cannot be changed to 93, as follows in the image below:
If it is changed to 93, when you click save button, it returns an error message
Follow my code below:
if(workOrderStateNew == "93")
{
var oGrid = scr.getGrid("WorkOrderOperation");
var rowNum = oGrid.getRowCount();
var oCOperationState = scr.getObject("COperationState");
var array = [oGrid,rowNum,oCOperationState];
if (rowNum > 0)
{
for(var i = 1; i <= rowNum; i++)
{
if(array[2] == "C")
{
console.log('erro no array 2')
gm.showMessage(gm.loadResString("ERRORWORKTYPEESTATE", "PREVENTIVA", workOrderStateNew), MSGICON.IconError);
return false;
}
}
}
}
It is not running when I click save, even changing to 93 it does not return me the error message when I click save, ja dei console in my condition and the console also does not return anything, which may be?
The function comes from the variable:
var workOrderState = selectSentence.selectCommandOneValue1T1W("workOrderState", "WorkOrder", "workOrder", scr.getValue("TBWorkOrder"), true );
It’s not getting into the
if(workOrderStateNew == "93")
? Where does this variable come fromworkOrderStateNew
? How she is declared?– Sam
@Sam did the edits
– Lucas Tadeu Egídio Arruda
I needed to see how the function containing the code is declared
if(workOrderStateNew == "93")...
and the portions of code that invoke that function, events, direct and indirect calls.– Augusto Vasques