Wednesday, 28 May 2014

Getting this in VCO? TypeError: Cannot call method "push" of null

I have recently joined one of the UK's best consultancies as a Senior Consultant, initially specialising in VMware vCenter Orchestrator (vCO) and VMware vCloud Automation Center (VCAC).

Today whilst working on some VCO workflows I kept getting the below error despite setting up the inputs correctly and binding them;

TypeError: Cannot call method "push" of null

This was happening when I had an input atttibute (lets say it was "jimsarray") defined as an array/string, and was using the javscript code;

jimsarray.push("ArrayEntry1")

The attribute was correctly bound in the data binder, but it appears that due to the order in which I created things, the starting value for "jimsarray" was "Not Set" i.e. Null - hence the error

The trick was to go into visual binding, and double click on any array/string in “IN attribute”. Then click on the value “not set”, then click Accept then OK. You will now see the value is "Array", and the error will be gone!