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

Succeeded

Processed 1 out of 1 item (100%).

Ran for less than 10 seconds, finished .

Arguments:
emails
[FILTERED]

Metadata:
user_id
Succeeded

Processed 1 out of 1 item (100%).

Ran for less than 5 seconds, finished .

Arguments:
emails
[FILTERED]

Metadata:
user_id
Succeeded

Processed 1 out of 1 item (100%).

Ran for less than 5 seconds, finished .

Arguments:
emails
[FILTERED]

Metadata:
user_id
Succeeded

Processed 1 out of 1 item (100%).

Ran for less than 5 seconds, 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 .

Api::Errors::BadRequestError

[{"message":"\nWHERE Id = 'sales_id_test'\n ^\nERROR at Row:27:Column:7\ninvalid ID field: sales_id_test","errorCode":"INVALID_QUERY_FILTER_OPERATOR"}]

lib/api/base_client.rb:43:in 'Api::BaseClient::Agent#handle_errors'
lib/api/base_client.rb:30:in 'block (2 levels) in <class:Agent>'
lib/api/base_client.rb:10:in 'Api::BaseClient::Wrapper#get'
lib/api/salesforce.rb:12:in 'Api::Salesforce::Wrapper#query'
app/services/salesforce/account_with_parent_query.rb:60:in 'Salesforce::AccountWithParentQuery#execute_query'
app/services/salesforce/account_with_parent_query.rb:13:in 'Salesforce::AccountWithParentQuery#call'
app/services/salesforce/global_account.rb:30: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: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/raw_data_with_relations_extractor.rb:46:in 'CustomFields::RawDataWithRelationsExtractor#fetch_base_data'
app/services/custom_fields/raw_data_with_relations_extractor.rb:34:in 'CustomFields::RawDataWithRelationsExtractor#process_custom_field'
app/services/custom_fields/raw_data_with_relations_extractor.rb:22:in 'block in CustomFields::RawDataWithRelationsExtractor#call'
app/services/custom_fields/raw_data_with_relations_extractor.rb:22:in 'CustomFields::RawDataWithRelationsExtractor#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 .

Api::Errors::BadRequestError

[{"message":"\nWHERE Id = 'sales_id_test'\n ^\nERROR at Row:27:Column:7\ninvalid ID field: sales_id_test","errorCode":"INVALID_QUERY_FILTER_OPERATOR"}]

lib/api/base_client.rb:43:in 'Api::BaseClient::Agent#handle_errors'
lib/api/base_client.rb:30:in 'block (2 levels) in <class:Agent>'
lib/api/base_client.rb:10:in 'Api::BaseClient::Wrapper#get'
lib/api/salesforce.rb:12:in 'Api::Salesforce::Wrapper#query'
app/services/salesforce/account_with_parent_query.rb:60:in 'Salesforce::AccountWithParentQuery#execute_query'
app/services/salesforce/account_with_parent_query.rb:13:in 'Salesforce::AccountWithParentQuery#call'
app/services/salesforce/global_account.rb:30: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: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/raw_data_with_relations_extractor.rb:46:in 'CustomFields::RawDataWithRelationsExtractor#fetch_base_data'
app/services/custom_fields/raw_data_with_relations_extractor.rb:34:in 'CustomFields::RawDataWithRelationsExtractor#process_custom_field'
app/services/custom_fields/raw_data_with_relations_extractor.rb:22:in 'block in CustomFields::RawDataWithRelationsExtractor#call'
app/services/custom_fields/raw_data_with_relations_extractor.rb:22:in 'CustomFields::RawDataWithRelationsExtractor#call'
app/tasks/maintenance/export_custom_fields_with_relations_task.rb:12:in 'Maintenance::ExportCustomFieldsWithRelationsTask#process'
Arguments:
emails
[FILTERED]

Metadata:
user_id