Answers.Body: <p>Lesley, I think you are confused with civicrm_financial_trxn.id v/s civicrm_financial_trxn.trxn_id field. </p>
  
  <p>id is a primary Auto-increment integer field and cannot be null. However trxn_id hold transaction id received from payment processor or manually entered through CiviCRM form and can be NULL since for payments taken as for eg cash won't have transactions id. </p>
  
  <p>There can be various reasons why a payment won't have transactions id. Payments taken from payment processor should have trxn_id, you can fire an sql query to find if any payment processor payments has missing transaction id</p>
  
  <pre><code>SELECT id, trxn_id FROM civicrm_financial_trxn WHERE payment_processor_id IS NOT NULL AND is_payment = 1;
  </code></pre>
  
  <p>Cheers</p>
  
  <p>Pradeep</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-04-13T22:50:42.377Z
Answers.Text: Hi Pradeep, you are right, it is NOT the primary key (id) but trxn_id) otherwise the row cannot be written.  Thanks for that clarification!  I also queried the payment processor ID on those, so I can look into that issue.
Answers.UserDisplayName: Lesley Evensen
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-04-13T22:55:20.187Z
Answers.Text: Please consider this question answered! (kicking myself!)
Answers.UserDisplayName: Lesley Evensen
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-04-14T10:53:55.870Z
Answers.Text: so can we mark this as answered?
Answers.UserDisplayName: Pradeep Nayak
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-04-13T22:44:07.487Z
Answers.LastActivityDate: 2019-04-13T22:44:07.487Z
Answers.UserDisplayName: Pradeep Nayak
Body: <p>I only now noticed that trxn_id was NULL for a number of rows on a particular date, for payment transactions in civicrm_financial_trxn. The schema/table def. shows that trxn_id cannot be null in civicrm_financial_trxn, and as expected, is set to auto-increment - what could account for those null IDs?
   I don't have root access so cannot see mysql log from that date. Total_amount is > 0, status_id = 1, datetime stamps are there, the rows were written, but trxn_id is NULL btwn ~ 14:00 and 21:00 on that date.</p>
  
Tags: <civievent>
Title: Civicrm_financial_trxn missing trxn_id
ThreadText: # Civicrm_financial_trxn missing trxn_id
  
  (Asked by: username_0 on 2019-04-13)
  
  I only now noticed that trxn\_id was NULL for a number of rows on a particular date, for payment transactions in civicrm\_financial\_trxn. The schema/table def. shows that trxn\_id cannot be null in civicrm\_financial\_trxn, and as expected, is set to auto-increment - what could account for those null IDs?
  I don't have root access so cannot see mysql log from that date. Total\_amount is > 0, status\_id = 1, datetime stamps are there, the rows were written, but trxn\_id is NULL btwn ~ 14:00 and 21:00 on that date.
  
  **Tags:** civievent
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2019-04-13. Score: 0
  
  Lesley, I think you are confused with civicrm_financial_trxn.id v/s civicrm_financial_trxn.trxn_id field. 
  id is a primary Auto-increment integer field and cannot be null. However trxn_id hold transaction id received from payment processor or manually entered through CiviCRM form and can be NULL since for payments taken as for eg cash won't have transactions id. 
  There can be various reasons why a payment won't have transactions id. Payments taken from payment processor should have trxn_id, you can fire an sql query to find if any payment processor payments has missing transaction id
  SELECT id, trxn_id FROM civicrm_financial_trxn WHERE payment_processor_id IS NOT NULL AND is_payment = 1;
  
  Cheers
  Pradeep
  
  > **Comments:**
  > **username_0**: Hi Pradeep, you are right, it is NOT the primary key (id) but trxn_id) otherwise the row cannot be written.  Thanks for that clarification!  I also queried the payment processor ID on those, so I can look into that issue.  
  > **username_0**: Please consider this question answered! (kicking myself!)  
  > **username_1**: so can we mark this as answered?  
  
  ---
  
  