How to check field with javascript

Asked

Viewed 50 times

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:

inserir a descrição da imagem aqui

If it is changed to 93, when you click save button, it returns an error message

inserir a descrição da imagem aqui

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 );
  • 1

    It’s not getting into the if(workOrderStateNew == "93")? Where does this variable come from workOrderStateNew? How she is declared?

  • @Sam did the edits

  • 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.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.