Code to create entity reference replacement fields.