Announcement

Collapse
No announcement yet.

Create records in campaign_log_record

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Create records in campaign_log_record

    Hi,

    I developed my own bounced mails management and I want to insert a record in the table campaign_log_record but I'm wondering how I can build the ID, could you give me a clue? Thanks!
    Last edited by rorosa; 02-08-2017, 03:24 AM.

  • #2
    If you create a record without ID, this field automatically is set.

    But if you need to set ID in traditional way, open /application/Espo/Core/ORM/Repositories/RDB.php, there you can find the row, where is ID setting for new entity
    $entity->set('id', Util::generateId()); (application/Espo/Core/Utils/Util.php - source code)

    Comment


    • #3
      It doesn't create the ID automatically:

      SENTENCE:
      insert into campaign_log_record ( `deleted`, `action`, `action_date`, `data`, `string_data`, `string_additional_data`, `application`, `created_at`, `is_test`, `created_by_id`, `campaign_id`, `parent_id`, `parent_type`, `object_id`, `object_type`, `queue_item_id`)
      select `deleted`, 'Bounced' as `action`, now() as `action_date`, `data`, `string_data`, `string_additional_data`, `application`, now() as `created_at`, `is_test`, `created_by_id`, `campaign_id`, `parent_id`, `parent_type`, `object_id`, `object_type`, `queue_item_id` from campaign_log_record

      Result in uploaded picture.

      Many thanks for your quick support!

      Comment


      • #4
        Why are you creating log records directly in database? If you really need this, open source code, I wrote before, method generateId

        Comment


        • #5
          Many thanks! I finish my development, that was very helpful!

          Comment

          Working...
          X