custom_fields.rb 588 B

123456789101112131415161718192021
  1. # Copyright (C) 2012-2023 Zammad Foundation, https://zammad-foundation.org/
  2. class Sequencer::Unit::Import::Zendesk::Ticket::CustomFields < Sequencer::Unit::Import::Zendesk::Common::CustomFields
  3. uses :ticket_field_map
  4. private
  5. def remote_fields
  6. custom_fields = resource.custom_fields
  7. return {} if custom_fields.blank?
  8. custom_fields.select { |custom_field| ticket_field_map[ custom_field['id'] ].present? }
  9. .to_h do |custom_field|
  10. [
  11. ticket_field_map[ custom_field['id'] ].to_sym, # remote_name
  12. custom_field['value']
  13. ]
  14. end
  15. end
  16. end