only add external metadata ref if IDs exist