When does zcrm_potential_id get assigned to an invoice in Books?

When does zcrm_potential_id get assigned to an invoice in Books?

At what point does zcrm_potential_id get assigned to an invoice in Books?

Does it happen only after a scheduled sync in Books or should it happen instantly when a Books invoice is created from within CRM?