4 Replies Latest reply on May 21, 2019 5:29 AM by iiliev

    vRO Error

    Bunty11 Enthusiast

      I am getting below error when running my workflow in vRO


      "" TypeError: Cannot call method "indexOf" of null (Workflow:Alerts / (item2)#9)'   ""


      unable to find out what error it is exactly ?

        • 1. Re: vRO Error
          daphnissov Guru
          Community WarriorsvExpert

          Unless you show us your code we cannot help you.

          • 2. Re: vRO Error
            iiliev Champion
            VMware EmployeesCommunity Warriors

            This error means that on line 9 in workflow item with ID item2 you have a code that looks something like the following:


            var result = somestring.indexOf("something");


            and that the object on which indexOf() method is invoked (somestring in the code above) has a null value, causing the exception to be thrown at runtime.


            Now, why the value is null is hard to say. Maybe you forgot to bind it as an input taking its value from previous workflow item. Or the variable may not be initialized properly. Or could be something else. I'd suggest to instrument your workflow scripting code with additional System.log() statements to trace what exactly is happening at runtime.

            1 person found this helpful
            • 3. Re: vRO Error
              Bunty11 Enthusiast

              Thank You for your help.


              Below line was in my code . and PSOUTPUT is going as NULL. Therefore i am getting the error.


              if(psOutput.indexOf("Error In Operation") == -1)


              Have you passed Powershell output from Workflow item to another ?

              How did you passed the Powershell output ??? I mean the PSOUTPUT Variable that we are passing should be declared as string ??

              • 4. Re: vRO Error
                iiliev Champion
                VMware EmployeesCommunity Warriors

                Your scripting code looks fine. What you can do as a quick patch is to just add one additional if() check for psOutput value being null in order to not use it in expressions like psOutput.indeOf() that would throw an error if the object is null.


                I'm not familiar enough with the plug-in to say whether a null value is valid/expected as a result from method getHostOutput(). If a null value is the normal result when the invoked script produces no output, then the null check suggested above is the proper thing to do.

                1 person found this helpful