Answers.Body: <p>I have temporarily solved it by making a change to the core CRM_Contribute_Form_Task_Invoice to use my function for invoice generation if the class I use can be found. Temporary fix for the customer with their current version.</p>
  
  <p>What I am planning on doing as a core PR is taking out the invoiceId generation in CRM_Contribute_Form_Task_Invoice and replace it with an API call: Invoice Generate. That means anyone who wants to customize it can use the apiWrapper hook to do so. Does that make sense?</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-03-30T16:34:30.517Z
Answers.Text: Another option is to use the Contribution BAO to update the invoice id. That makes invoice generation possible in the post hook.
Answers.UserDisplayName: Kainuk - CiviCooP
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-01-27T16:20:15.107Z
Answers.LastActivityDate: 2017-01-27T16:20:15.107Z
Answers.UserDisplayName: ErikH - CiviCooP
Body: <p>I need a customized invoice generation. So I thought that would be pretty straightforward: I use the civicrm_post hook on Contribution when the invoice ID is updated. Unfortunately the contribution post hook is not called when the invoice_id is updated. Any suggestion on how I tackle this now for this specific instance (and yes, I will also add a PR for a core change to call the post hook when the invoice id is updated in the contribution)?</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-03-30T16:30:43.870Z
Comments.Text: FYI https://issues.civicrm.org/jira/browse/CRM-20363 .
Comments.UserDisplayName: Kainuk - CiviCooP
Tags: <civicontribute><invoice>
Title: How do I generate a custom invoice ID
ThreadText: # How do I generate a custom invoice ID
  
  (Asked by: username_0 on 2017-01-26)
  
  I need a customized invoice generation. So I thought that would be pretty straightforward: I use the civicrm\_post hook on Contribution when the invoice ID is updated. Unfortunately the contribution post hook is not called when the invoice\_id is updated. Any suggestion on how I tackle this now for this specific instance (and yes, I will also add a PR for a core change to call the post hook when the invoice id is updated in the contribution)?
  
  **Tags:** civicontribute, invoice
  
  > **Comments:**
  > **username_1**: FYI https://issues.civicrm.org/jira/browse/CRM-20363 .  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2017-01-27. Score: 1
  
  I have temporarily solved it by making a change to the core CRM\_Contribute\_Form\_Task\_Invoice to use my function for invoice generation if the class I use can be found. Temporary fix for the customer with their current version.
  
  What I am planning on doing as a core PR is taking out the invoiceId generation in CRM\_Contribute\_Form\_Task\_Invoice and replace it with an API call: Invoice Generate. That means anyone who wants to customize it can use the apiWrapper hook to do so. Does that make sense?
  
  > **Comments:**
  > **username_1**: Another option is to use the Contribution BAO to update the invoice id. That makes invoice generation possible in the post hook.  
  
  ---
  
  