Can I use object's Custom Properties inside Cycles materials?
An alternative to using the pass ID is using the object name and an OSL script. It is not very elegant either, but at least allows for setting multiple values. I have explained it here.