Answers.Body: <p>Yes, its possible to alter the content of exported files. Either you can create your separate export type or can use combination of hook_civicrm_batchItems and hook_civicrm_batchQuery  </p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-04-24T13:57:34.677Z
Answers.Text: Thank you, Pradeep, but those hooks look like they allow the change of the input for the exporting.  What I would like to do is change the actual exported line.  I want to be able to fill the CLASS column in an if file.  The template for the iif file doesn't export class.
Answers.UserDisplayName: Logan Bear
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-04-23T21:39:38.417Z
Answers.LastActivityDate: 2020-04-23T21:39:38.417Z
Answers.UserDisplayName: Pradeep Nayak
Answers.Body: <p>What I ended up doing was customize the template for the iif export:
  [civicrm.template_dir]/CRM/Financial/ExportBatch/iif.tpl</p>
  
  <p>And the ExportFormat BAO:
  [civicrm.php_dir]/CRM/Financial/ExportBatch/iif.php</p>
  
  <p>We enter the Financial Account name now as: [Account Name].[Class]</p>
  
  <p>This was decided because the colon and slash were used in Account Names.  The PHP file breaks out the class from the Account Name, if used.  Otherwise the Class name is NULL.</p>
  
  <p>The template then exports the class name in the appropriate column.  And the iif file properly imports.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-04-28T17:41:40.843Z
Answers.LastActivityDate: 2020-04-28T17:41:40.843Z
Answers.UserDisplayName: Logan Bear
Body: <p>My organization uses QuickBooks Online Plus, and implemented the Classes system.  We also use Campaigns as Campaigns in CiviCRM, so all the previous solutions do not work for us.</p>
  
  <p>So, we came up with a possible solution, but it would require a change to the export function.  We are thinking that we use the Financial Account name to hold both the Account Name and the Class Name.  For example, we have two Financial Accounts: Member Dues:National and Member Dues:Chapter.  The colon separates the account from the class.   But for this to work in the export, I need to get the journal entry transaction before it gets written.</p>
  
  <p>We can't use the Campaigns feature for this because we do have fundraising campaigns as well as petitioning and membership campaigns.  The name seems to be our best solution, but we're not sure how to get it to work.  It's beginning to look like it would be a patch to core. ::shudder::</p>
  
Tags: <financial-accounts><quickbooks>
Title: Is there a hook for writing a record to an export batch?
ThreadText: # Is there a hook for writing a record to an export batch?
  
  (Asked by: username_0 on 2020-04-23)
  
  My organization uses QuickBooks Online Plus, and implemented the Classes system. We also use Campaigns as Campaigns in CiviCRM, so all the previous solutions do not work for us.
  
  So, we came up with a possible solution, but it would require a change to the export function. We are thinking that we use the Financial Account name to hold both the Account Name and the Class Name. For example, we have two Financial Accounts: Member Dues:National and Member Dues:Chapter. The colon separates the account from the class. But for this to work in the export, I need to get the journal entry transaction before it gets written.
  
  We can't use the Campaigns feature for this because we do have fundraising campaigns as well as petitioning and membership campaigns. The name seems to be our best solution, but we're not sure how to get it to work. It's beginning to look like it would be a patch to core. ::shudder::
  
  **Tags:** financial-accounts, quickbooks
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2020-04-23. Score: 1
  
  Yes, its possible to alter the content of exported files. Either you can create your separate export type or can use combination of hook\_civicrm\_batchItems and hook\_civicrm\_batchQuery
  
  > **Comments:**
  > **username_0**: Thank you, username_1, but those hooks look like they allow the change of the input for the exporting.  What I would like to do is change the actual exported line.  I want to be able to fill the CLASS column in an if file.  The template for the iif file doesn't export class.  
  
  ---
  
  ### Answer by username_0 on 2020-04-28. Score: 0
  
  What I ended up doing was customize the template for the iif export:
  [civicrm.template\_dir]/CRM/Financial/ExportBatch/iif.tpl
  
  And the ExportFormat BAO:
  [civicrm.php\_dir]/CRM/Financial/ExportBatch/iif.php
  
  We enter the Financial Account name now as: [Account Name].[Class]
  
  This was decided because the colon and slash were used in Account Names. The PHP file breaks out the class from the Account Name, if used. Otherwise the Class name is NULL.
  
  The template then exports the class name in the appropriate column. And the iif file properly imports.
  
  
  ---
  
  