Maintenance::ExportCustomFieldsWithRelationsTask

Source code
# frozen_string_literal: true

class Maintenance::ExportCustomFieldsWithRelationsTask < MaintenanceTasks::Task
  include ArrayHelper

  no_collection

  attribute :emails, :string
  validates :emails, presence: true, fcm_email_format: true

  def process
    CsvGenerator.new.call do |file|
      CustomFields::DataWithRelationsExtractor.new.call do |line|
        file.puts(line)
      end

      CsvReportMailer.send_report(
        recipients: emails_array(emails),
        file_path: file.path,
        report_sender: 'Reporting Fields'
      ).deliver_now
    end
  end
end

Previous Runs

Errored

Processed 0 out of 1 item (0%).

Ran for less than 5 seconds until an error happened .

Utils::Errors::SalesforceNotFound

Salesforce record with the given ID was not found or is inaccessible. ID: 001Vl00000J6Y4GIAV - code:1014

app/services/salesforce/top_parent_account.rb:33:in 'Salesforce::TopParentAccount#fetch_record'
app/services/salesforce/top_parent_account.rb:19:in 'Salesforce::TopParentAccount#find_deepest_top_account'
app/services/salesforce/top_parent_account.rb:11:in 'Salesforce::TopParentAccount#call'
app/models/legal_entity.rb:31:in 'block in LegalEntity#top_parent_salesforce_id'
app/models/legal_entity.rb:30:in 'LegalEntity#top_parent_salesforce_id'
app/services/custom_fields/data_with_relations_extractor.rb:43:in 'CustomFields::DataWithRelationsExtractor#fetch_base_data'
app/services/custom_fields/data_with_relations_extractor.rb:33:in 'CustomFields::DataWithRelationsExtractor#build_rows_for_custom_field'
app/services/custom_fields/data_with_relations_extractor.rb:27:in 'block in CustomFields::DataWithRelationsExtractor#build_rows'
app/services/custom_fields/data_with_relations_extractor.rb:26:in 'Array#each'
app/services/custom_fields/data_with_relations_extractor.rb:26:in 'Enumerable#flat_map'
app/services/custom_fields/data_with_relations_extractor.rb:26:in 'CustomFields::DataWithRelationsExtractor#build_rows'
app/services/custom_fields/data_with_relations_extractor.rb:19:in 'block in CustomFields::DataWithRelationsExtractor#call'
app/services/custom_fields/data_with_relations_extractor.rb:18:in 'CustomFields::DataWithRelationsExtractor#call'
app/tasks/maintenance/export_custom_fields_with_relations_task.rb:13:in 'block in Maintenance::ExportCustomFieldsWithRelationsTask#process'
app/services/csv_generator.rb:9:in 'CsvGenerator#call'
app/tasks/maintenance/export_custom_fields_with_relations_task.rb:12:in 'Maintenance::ExportCustomFieldsWithRelationsTask#process'
Arguments:
emails
[FILTERED]

Metadata:
user_id
Errored

Processed 0 out of 1 item (0%).

Ran for less than 5 seconds until an error happened .

Utils::Errors::SalesforceNotFound

Salesforce record with the given ID was not found or is inaccessible. ID: 001Vl00000J6Y4GIAV - code:1014

app/services/salesforce/top_parent_account.rb:33:in 'Salesforce::TopParentAccount#fetch_record'
app/services/salesforce/top_parent_account.rb:19:in 'Salesforce::TopParentAccount#find_deepest_top_account'
app/services/salesforce/top_parent_account.rb:11:in 'Salesforce::TopParentAccount#call'
app/models/legal_entity.rb:31:in 'block in LegalEntity#top_parent_salesforce_id'
app/models/legal_entity.rb:30:in 'LegalEntity#top_parent_salesforce_id'
app/services/custom_fields/data_with_relations_extractor.rb:43:in 'CustomFields::DataWithRelationsExtractor#fetch_base_data'
app/services/custom_fields/data_with_relations_extractor.rb:33:in 'CustomFields::DataWithRelationsExtractor#build_rows_for_custom_field'
app/services/custom_fields/data_with_relations_extractor.rb:27:in 'block in CustomFields::DataWithRelationsExtractor#build_rows'
app/services/custom_fields/data_with_relations_extractor.rb:26:in 'Array#each'
app/services/custom_fields/data_with_relations_extractor.rb:26:in 'Enumerable#flat_map'
app/services/custom_fields/data_with_relations_extractor.rb:26:in 'CustomFields::DataWithRelationsExtractor#build_rows'
app/services/custom_fields/data_with_relations_extractor.rb:19:in 'block in CustomFields::DataWithRelationsExtractor#call'
app/services/custom_fields/data_with_relations_extractor.rb:18:in 'CustomFields::DataWithRelationsExtractor#call'
app/tasks/maintenance/export_custom_fields_with_relations_task.rb:13:in 'block in Maintenance::ExportCustomFieldsWithRelationsTask#process'
app/services/csv_generator.rb:9:in 'CsvGenerator#call'
app/tasks/maintenance/export_custom_fields_with_relations_task.rb:12:in 'Maintenance::ExportCustomFieldsWithRelationsTask#process'
Arguments:
emails
[FILTERED]

Metadata:
user_id
Errored

Processed 0 out of 1 item (0%).

Ran for less than 5 seconds until an error happened .

Utils::Errors::SalesforceNotFound

Salesforce record with the given ID was not found or is inaccessible. ID: 001Vl00000J6Y4GIAV - code:1014

app/services/salesforce/top_parent_account.rb:33:in 'Salesforce::TopParentAccount#fetch_record'
app/services/salesforce/top_parent_account.rb:19:in 'Salesforce::TopParentAccount#find_deepest_top_account'
app/services/salesforce/top_parent_account.rb:11:in 'Salesforce::TopParentAccount#call'
app/models/legal_entity.rb:31:in 'block in LegalEntity#top_parent_salesforce_id'
app/models/legal_entity.rb:30:in 'LegalEntity#top_parent_salesforce_id'
app/services/custom_fields/data_with_relations_extractor.rb:43:in 'CustomFields::DataWithRelationsExtractor#fetch_base_data'
app/services/custom_fields/data_with_relations_extractor.rb:33:in 'CustomFields::DataWithRelationsExtractor#build_rows_for_custom_field'
app/services/custom_fields/data_with_relations_extractor.rb:27:in 'block in CustomFields::DataWithRelationsExtractor#build_rows'
app/services/custom_fields/data_with_relations_extractor.rb:26:in 'Array#each'
app/services/custom_fields/data_with_relations_extractor.rb:26:in 'Enumerable#flat_map'
app/services/custom_fields/data_with_relations_extractor.rb:26:in 'CustomFields::DataWithRelationsExtractor#build_rows'
app/services/custom_fields/data_with_relations_extractor.rb:19:in 'block in CustomFields::DataWithRelationsExtractor#call'
app/services/custom_fields/data_with_relations_extractor.rb:18:in 'CustomFields::DataWithRelationsExtractor#call'
app/tasks/maintenance/export_custom_fields_with_relations_task.rb:13:in 'block in Maintenance::ExportCustomFieldsWithRelationsTask#process'
app/services/csv_generator.rb:9:in 'CsvGenerator#call'
app/tasks/maintenance/export_custom_fields_with_relations_task.rb:12:in 'Maintenance::ExportCustomFieldsWithRelationsTask#process'
Arguments:
emails
[FILTERED]

Metadata:
user_id
Errored

Processed 0 out of 1 item (0%).

Ran for less than 5 seconds until an error happened .

Utils::Errors::SalesforceNotFound

Salesforce record with the given ID was not found or is inaccessible. ID: 001Vl00000J6Y4GIAV - code:1014

app/services/salesforce/top_parent_account.rb:33:in 'Salesforce::TopParentAccount#fetch_record'
app/services/salesforce/top_parent_account.rb:19:in 'Salesforce::TopParentAccount#find_deepest_top_account'
app/services/salesforce/top_parent_account.rb:11:in 'Salesforce::TopParentAccount#call'
app/models/legal_entity.rb:31:in 'block in LegalEntity#top_parent_salesforce_id'
app/models/legal_entity.rb:30:in 'LegalEntity#top_parent_salesforce_id'
app/services/custom_fields/data_with_relations_extractor.rb:43:in 'CustomFields::DataWithRelationsExtractor#fetch_base_data'
app/services/custom_fields/data_with_relations_extractor.rb:33:in 'CustomFields::DataWithRelationsExtractor#build_rows_for_custom_field'
app/services/custom_fields/data_with_relations_extractor.rb:27:in 'block in CustomFields::DataWithRelationsExtractor#build_rows'
app/services/custom_fields/data_with_relations_extractor.rb:26:in 'Array#each'
app/services/custom_fields/data_with_relations_extractor.rb:26:in 'Enumerable#flat_map'
app/services/custom_fields/data_with_relations_extractor.rb:26:in 'CustomFields::DataWithRelationsExtractor#build_rows'
app/services/custom_fields/data_with_relations_extractor.rb:19:in 'block in CustomFields::DataWithRelationsExtractor#call'
app/services/custom_fields/data_with_relations_extractor.rb:18:in 'CustomFields::DataWithRelationsExtractor#call'
app/tasks/maintenance/export_custom_fields_with_relations_task.rb:13:in 'block in Maintenance::ExportCustomFieldsWithRelationsTask#process'
app/services/csv_generator.rb:9:in 'CsvGenerator#call'
app/tasks/maintenance/export_custom_fields_with_relations_task.rb:12:in 'Maintenance::ExportCustomFieldsWithRelationsTask#process'
Arguments:
emails
[FILTERED]

Metadata:
user_id
Errored

Processed 0 out of 1 item (0%).

Ran for less than 5 seconds until an error happened .

Utils::Errors::SalesforceNotFound

Salesforce record with the given ID was not found or is inaccessible. ID: 001Vl00000J6Y4GIAV - code:1014

app/services/salesforce/top_parent_account.rb:33:in 'Salesforce::TopParentAccount#fetch_record'
app/services/salesforce/top_parent_account.rb:19:in 'Salesforce::TopParentAccount#find_deepest_top_account'
app/services/salesforce/top_parent_account.rb:11:in 'Salesforce::TopParentAccount#call'
app/models/legal_entity.rb:31:in 'block in LegalEntity#top_parent_salesforce_id'
app/models/legal_entity.rb:30:in 'LegalEntity#top_parent_salesforce_id'
app/services/custom_fields/data_with_relations_extractor.rb:43:in 'CustomFields::DataWithRelationsExtractor#fetch_base_data'
app/services/custom_fields/data_with_relations_extractor.rb:33:in 'CustomFields::DataWithRelationsExtractor#build_rows_for_custom_field'
app/services/custom_fields/data_with_relations_extractor.rb:27:in 'block in CustomFields::DataWithRelationsExtractor#build_rows'
app/services/custom_fields/data_with_relations_extractor.rb:26:in 'Array#each'
app/services/custom_fields/data_with_relations_extractor.rb:26:in 'Enumerable#flat_map'
app/services/custom_fields/data_with_relations_extractor.rb:26:in 'CustomFields::DataWithRelationsExtractor#build_rows'
app/services/custom_fields/data_with_relations_extractor.rb:19:in 'block in CustomFields::DataWithRelationsExtractor#call'
app/services/custom_fields/data_with_relations_extractor.rb:18:in 'CustomFields::DataWithRelationsExtractor#call'
app/tasks/maintenance/export_custom_fields_with_relations_task.rb:13:in 'block in Maintenance::ExportCustomFieldsWithRelationsTask#process'
app/services/csv_generator.rb:9:in 'CsvGenerator#call'
app/tasks/maintenance/export_custom_fields_with_relations_task.rb:12:in 'Maintenance::ExportCustomFieldsWithRelationsTask#process'
Arguments:
emails
[FILTERED]

Metadata:
user_id
Errored

Processed 0 out of 1 item (0%).

Ran for less than 5 seconds until an error happened .

Utils::Errors::SalesforceNotFound

Salesforce record with the given ID was not found or is inaccessible. ID: 001Vl00000J6Y4GIAV - code:1014

app/services/salesforce/top_parent_account.rb:33:in 'Salesforce::TopParentAccount#fetch_record'
app/services/salesforce/top_parent_account.rb:19:in 'Salesforce::TopParentAccount#find_deepest_top_account'
app/services/salesforce/top_parent_account.rb:11:in 'Salesforce::TopParentAccount#call'
app/models/legal_entity.rb:31:in 'block in LegalEntity#top_parent_salesforce_id'
app/models/legal_entity.rb:30:in 'LegalEntity#top_parent_salesforce_id'
app/services/custom_fields/data_with_relations_extractor.rb:43:in 'CustomFields::DataWithRelationsExtractor#fetch_base_data'
app/services/custom_fields/data_with_relations_extractor.rb:33:in 'CustomFields::DataWithRelationsExtractor#build_rows_for_custom_field'
app/services/custom_fields/data_with_relations_extractor.rb:27:in 'block in CustomFields::DataWithRelationsExtractor#build_rows'
app/services/custom_fields/data_with_relations_extractor.rb:26:in 'Array#each'
app/services/custom_fields/data_with_relations_extractor.rb:26:in 'Enumerable#flat_map'
app/services/custom_fields/data_with_relations_extractor.rb:26:in 'CustomFields::DataWithRelationsExtractor#build_rows'
app/services/custom_fields/data_with_relations_extractor.rb:19:in 'block in CustomFields::DataWithRelationsExtractor#call'
app/services/custom_fields/data_with_relations_extractor.rb:18:in 'CustomFields::DataWithRelationsExtractor#call'
app/tasks/maintenance/export_custom_fields_with_relations_task.rb:13:in 'block in Maintenance::ExportCustomFieldsWithRelationsTask#process'
app/services/csv_generator.rb:9:in 'CsvGenerator#call'
app/tasks/maintenance/export_custom_fields_with_relations_task.rb:12:in 'Maintenance::ExportCustomFieldsWithRelationsTask#process'
Arguments:
emails
[FILTERED]

Metadata:
user_id
Succeeded

Processed 1 out of 1 item (100%).

Ran for half a minute, finished .

Arguments:
emails
[FILTERED]

Metadata:
user_id
Succeeded

Processed 1 out of 1 item (100%).

Ran for half a minute, finished .

Arguments:
emails
[FILTERED]

Metadata:
user_id
Succeeded

Processed 1 out of 1 item (100%).

Ran for half a minute, finished .

Arguments:
emails
[FILTERED]

Metadata:
user_id
Succeeded

Processed 1 out of 1 item (100%).

Ran for half a minute, finished .

Arguments:
emails
[FILTERED]

Metadata:
user_id
Errored

Processed 0 out of 1 item (0%).

Ran for less than 5 seconds until an error happened .

Utils::Errors::SalesforceNotFound

Salesforce record with the given ID was not found or is inaccessible - code:1014

app/services/salesforce/global_account.rb:35:in 'Salesforce::GlobalAccount#fetch_record'
app/services/salesforce/global_account.rb:17:in 'Salesforce::GlobalAccount#find_deepest_global_account'
app/services/salesforce/global_account.rb:28:in 'Salesforce::GlobalAccount#find_deepest_global_account'
app/services/salesforce/global_account.rb:11:in 'Salesforce::GlobalAccount#call'
app/models/legal_entity.rb:25:in 'block in LegalEntity#global_salesforce_id'
app/models/legal_entity.rb:24:in 'LegalEntity#global_salesforce_id'
app/services/custom_fields/data_with_relations_extractor.rb:51:in 'CustomFields::DataWithRelationsExtractor#fetch_base_data'
app/services/custom_fields/data_with_relations_extractor.rb:39:in 'CustomFields::DataWithRelationsExtractor#process_custom_field'
app/services/custom_fields/data_with_relations_extractor.rb:34:in 'block in CustomFields::DataWithRelationsExtractor#process_batch'
app/services/custom_fields/data_with_relations_extractor.rb:34:in 'Array#each'
app/services/custom_fields/data_with_relations_extractor.rb:34:in 'CustomFields::DataWithRelationsExtractor#process_batch'
app/services/custom_fields/data_with_relations_extractor.rb:25:in 'block in CustomFields::DataWithRelationsExtractor#call'
app/services/custom_fields/data_with_relations_extractor.rb:24:in 'CustomFields::DataWithRelationsExtractor#call'
app/tasks/maintenance/export_custom_fields_with_relations_task.rb:12:in 'Maintenance::ExportCustomFieldsWithRelationsTask#process'
Arguments:
emails
[FILTERED]
Errored

Processed 0 out of 1 item (0%).

Ran for less than 5 seconds until an error happened .

Utils::Errors::SalesforceNotFound

Salesforce record with the given ID was not found or is inaccessible - code:1014

app/services/salesforce/global_account.rb:35:in 'Salesforce::GlobalAccount#fetch_record'
app/services/salesforce/global_account.rb:17:in 'Salesforce::GlobalAccount#find_deepest_global_account'
app/services/salesforce/global_account.rb:28:in 'Salesforce::GlobalAccount#find_deepest_global_account'
app/services/salesforce/global_account.rb:11:in 'Salesforce::GlobalAccount#call'
app/models/legal_entity.rb:25:in 'block in LegalEntity#global_salesforce_id'
app/models/legal_entity.rb:24:in 'LegalEntity#global_salesforce_id'
app/services/custom_fields/data_with_relations_extractor.rb:51:in 'CustomFields::DataWithRelationsExtractor#fetch_base_data'
app/services/custom_fields/data_with_relations_extractor.rb:39:in 'CustomFields::DataWithRelationsExtractor#process_custom_field'
app/services/custom_fields/data_with_relations_extractor.rb:34:in 'block in CustomFields::DataWithRelationsExtractor#process_batch'
app/services/custom_fields/data_with_relations_extractor.rb:34:in 'Array#each'
app/services/custom_fields/data_with_relations_extractor.rb:34:in 'CustomFields::DataWithRelationsExtractor#process_batch'
app/services/custom_fields/data_with_relations_extractor.rb:25:in 'block in CustomFields::DataWithRelationsExtractor#call'
app/services/custom_fields/data_with_relations_extractor.rb:24:in 'CustomFields::DataWithRelationsExtractor#call'
app/tasks/maintenance/export_custom_fields_with_relations_task.rb:12:in 'Maintenance::ExportCustomFieldsWithRelationsTask#process'
Arguments:
emails
[FILTERED]

Metadata:
user_id
Errored

Processed 0 out of 1 item (0%).

Ran for less than 5 seconds until an error happened .

Utils::Errors::SalesforceNotFound

Salesforce record with the given ID was not found or is inaccessible - code:1014

app/services/salesforce/global_account.rb:35:in 'Salesforce::GlobalAccount#fetch_record'
app/services/salesforce/global_account.rb:17:in 'Salesforce::GlobalAccount#find_deepest_global_account'
app/services/salesforce/global_account.rb:28:in 'Salesforce::GlobalAccount#find_deepest_global_account'
app/services/salesforce/global_account.rb:11:in 'Salesforce::GlobalAccount#call'
app/models/legal_entity.rb:25:in 'block in LegalEntity#global_salesforce_id'
app/models/legal_entity.rb:24:in 'LegalEntity#global_salesforce_id'
app/services/custom_fields/data_with_relations_extractor.rb:51:in 'CustomFields::DataWithRelationsExtractor#fetch_base_data'
app/services/custom_fields/data_with_relations_extractor.rb:39:in 'CustomFields::DataWithRelationsExtractor#process_custom_field'
app/services/custom_fields/data_with_relations_extractor.rb:34:in 'block in CustomFields::DataWithRelationsExtractor#process_batch'
app/services/custom_fields/data_with_relations_extractor.rb:34:in 'Array#each'
app/services/custom_fields/data_with_relations_extractor.rb:34:in 'CustomFields::DataWithRelationsExtractor#process_batch'
app/services/custom_fields/data_with_relations_extractor.rb:25:in 'block in CustomFields::DataWithRelationsExtractor#call'
app/services/custom_fields/data_with_relations_extractor.rb:24:in 'CustomFields::DataWithRelationsExtractor#call'
app/tasks/maintenance/export_custom_fields_with_relations_task.rb:12:in 'Maintenance::ExportCustomFieldsWithRelationsTask#process'
Arguments:
emails
[FILTERED]

Metadata:
user_id