Changed usage of customvariablestatus to customvariables table.

In legacy API.

Fixes #5702