Otrs import fails with ActiveRecord::RecordInvalid: Validation failed: Data option must have non-nil value for either :options or :relation

Infos:

  • Used Zammad version: 2.7.0
  • Used Zammad installation source: source
  • Operating system: ubuntu 18.04.1
  • Browser + version: Firefox 63.0.3

Expected behavior:

  • just tried to import from OTRS via command line but couldnt succeed any hints?

Actual behavior:

2.4.4 :004 > Import::OTRS.start
thread#-: Start import…
thread#-: POST: http://otrs.dmz.kyosy.de/otrs/public.pl?Action=ZammadMigrator
thread#-: PARAMS: {:Action=>“ZammadMigrator”, :Key=>“yH3lz9Y9cKsiS7nofF8Jut9DtVbWkglYrLvKSr0o”}
thread#-: loading SysConfig…
thread#-: POST: http://otrs.dmz.kyosy.de/otrs/public.pl?Action=ZammadMigrator
thread#-: PARAMS: {:Subaction=>“Export”, :Object=>“SysConfig”, :Limit=>"", :Offset=>"", :Diff=>0, :Action=>“ZammadMigrator”, :Key=>“yH3lz9Y9cKsiS7nofF8Jut9DtVbWkglYrLvKSr0o”}
Setting.reset_change_id: set new cache, 959777923
Setting.set(‘http_type’, “http”)
Setting.reset_change_id: set new cache, 579333356
Setting.set(‘organization’, “wir helfen e.V.”)
Setting.reset_change_id: set new cache, 675675237
Setting.set(‘system_id’, “33”)
Setting.reset_change_id: set new cache, 105298435
Setting.set(‘ticket_hook’, “Ticket#”)
Setting.reset_change_id: set new cache, 824518616
Setting.set(‘ticket_number’, “Ticket::Number::Date”)
Setting.reset_change_id: set new cache, 235921772
Setting.set(‘ticket_number_date’, {:checksum=>true})
thread#-: loading DynamicField…
thread#-: POST: http://otrs.dmz.kyosy.de/otrs/public.pl?Action=ZammadMigrator
thread#-: PARAMS: {:Subaction=>“Export”, :Object=>“DynamicField”, :Limit=>"", :Offset=>"", :Diff=>0, :Action=>“ZammadMigrator”, :Key=>“yH3lz9Y9cKsiS7nofF8Jut9DtVbWkglYrLvKSr0o”}
ActiveRecord::RecordInvalid: Validation failed: Data option must have non-nil value for either :options or :relation
from app/models/object_manager/attribute.rb:370:in add' from lib/import/otrs/dynamic_field.rb:56:inadd’
from lib/import/otrs/dynamic_field.rb:13:in initialize' from lib/import/base_factory.rb:36:innew’
from lib/import/base_factory.rb:36:in create_instance' from lib/import/base_factory.rb:12:inblock in import_action’
from lib/import/base_factory.rb:40:in each' from lib/import/base_factory.rb:40:inimport_loop’
from lib/import/base_factory.rb:9:in import_action' from lib/import/otrs.rb:148:inimport_action’
from lib/import/otrs.rb:73:in import' from lib/import/otrs.rb:158:inbase_objects’
from lib/import/otrs.rb:41:in `start’
from (irb):4
*

okay, just inspected a bit, the reason was ITSMDecisionResult and ITSMReviewRequired json blocks, skipped them in dynamic_field_factory.rb def skip_fields

Hi @tibet - cool that you figured it out by yourself - Kudos! It would be interesting for us to see the JSON of those fields to make the code more robust. Could you please provide the JSON here?

ofcourse there you are:

“Success”: 1, “Result”: [{
“FieldType”: “Text”,
“Label”: “SystemMonitoring HostName”,
“ChangeTime”: “2012-10-26 16:47:08”,
“CreateTime”: “2012-09-04 10:00:27”,
“ObjectType”: “Ticket”,
“Config”: {
“PossibleValues”: null,
“TranslatableValues”: “1”,
“DefaultValue”: null
},
“Name”: “TicketFreeText1”,
“ValidID”: “1”,
“InternalField”: “0”,
“ID”: “1”,
“FieldOrder”: “1”
}, {
“ObjectType”: “Ticket”,
“Config”: {
“DefaultValue”: “”
},
“Name”: “ProcessManagementProcessID”,
“FieldType”: “ProcessID”,
“CreateTime”: “2014-06-17 15:03:24”,
“Label”: “Process”,
“ChangeTime”: “2015-02-05 15:07:10”,
“ID”: “23”,
“FieldOrder”: “2”,
“ValidID”: “1”,
“InternalField”: “1”
}, {
“FieldType”: “ActivityID”,
“CreateTime”: “2014-06-17 15:03:24”,
“Label”: “Activity”,
“ChangeTime”: “2015-02-05 15:07:10”,
“ObjectType”: “Ticket”,
“Config”: {
“DefaultValue”: “”
},
“Name”: “ProcessManagementActivityID”,
“ValidID”: “1”,
“InternalField”: “1”,
“ID”: “25”,
“FieldOrder”: “3”
}, {
“ID”: “3”,
“FieldOrder”: “4”,
“ValidID”: “1”,
“InternalField”: “0”,
“ObjectType”: “Ticket”,
“Config”: {
“PossibleValues”: null,
“TranslatableValues”: “1”,
“DefaultValue”: null
},
“Name”: “TicketFreeText2”,
“FieldType”: “Text”,
“ChangeTime”: “2015-02-05 15:07:10”,
“Label”: “SystemMonitoring ServiceName”,
“CreateTime”: “2012-09-04 10:00:27”
}, {
“FieldOrder”: “6”,
“ID”: “7”,
“InternalField”: “1”,
“ValidID”: “1”,
“Name”: “ITSMCriticality”,
“ObjectType”: “Ticket”,
“Config”: {
“TranslatableValues”: “1”,
“PossibleValues”: {
“5 very high”: “5 very high”,
“4 high”: “4 high”,
“2 low”: “2 low”,
“1 very low”: “1 very low”,
“3 normal”: “3 normal”
},
“PossibleNone”: “1”,
“DefaultValue”: “”,
“Link”: “”
},
“Label”: “Criticality”,
“ChangeTime”: “2015-02-05 15:07:10”,
“CreateTime”: “2012-09-04 10:05:47”,
“FieldType”: “Dropdown”
}, {
“ObjectType”: “Ticket”,
“Config”: {
“PossibleNone”: “1”,
“PossibleValues”: {
“1 very low”: “1 very low”,
“3 normal”: “3 normal”,
“2 low”: “2 low”,
“5 very high”: “5 very high”,
“4 high”: “4 high”
},
“TranslatableValues”: “1”,
“Link”: “”,
“DefaultValue”: “3 normal”
},
“Name”: “ITSMImpact”,
“FieldType”: “Dropdown”,
“Label”: “Impact”,
“ChangeTime”: “2015-02-05 15:07:10”,
“CreateTime”: “2012-09-04 10:05:47”,
“ID”: “9”,
“FieldOrder”: “7”,
“ValidID”: “1”,
“InternalField”: “1”
}, {
“FieldType”: “Dropdown”,
“Label”: “Review Required”,
“ChangeTime”: “2015-02-05 15:07:10”,
“CreateTime”: “2012-09-04 10:05:47”,
“Config”: {
“TranslatableValues”: “1”,
“PossibleValues”: null,
“PossibleNone”: “0”,
“Link”: “”,
“DefaultValue”: null
},
“ObjectType”: “Ticket”,
“Name”: “ITSMReviewRequired”,
“ValidID”: “1”,
“InternalField”: “1”,
“ID”: “11”,
“FieldOrder”: “8”
}, {
“ValidID”: “1”,
“InternalField”: “1”,
“ID”: “13”,
“FieldOrder”: “9”,
“FieldType”: “Dropdown”,
“CreateTime”: “2012-09-04 10:05:48”,
“Label”: “Decision Result”,
“ChangeTime”: “2015-02-05 15:07:10”,
“Config”: {
“PossibleValues”: null,
“PossibleNone”: “1”,
“TranslatableValues”: “1”,
“Link”: “”,
“DefaultValue”: null
},
“ObjectType”: “Ticket”,
“Name”: “ITSMDecisionResult”
}, {
“FieldType”: “DateTime”,
“Label”: “Repair Start Time”,
“ChangeTime”: “2015-02-05 15:07:10”,
“CreateTime”: “2012-09-04 10:05:48”,
“ObjectType”: “Ticket”,
“Config”: {
“YearsPeriod”: “1”,
“YearsInPast”: “5”,
“DefaultValue”: null,
“YearsInFuture”: “5”,
“Link”: “”
},
“Name”: “ITSMRepairStartTime”,
“ValidID”: “1”,
“InternalField”: “1”,
“ID”: “15”,
“FieldOrder”: “10”
}, {
“ID”: “17”,
“FieldOrder”: “11”,
“ValidID”: “1”,
“InternalField”: “1”,
“Config”: {
“YearsInFuture”: “5”,
“YearsInPast”: “5”,
“YearsPeriod”: “1”,
“DefaultValue”: null,
“Link”: “”
},
“ObjectType”: “Ticket”,
“Name”: “ITSMRecoveryStartTime”,
“FieldType”: “DateTime”,
“Label”: “Recovery Start Time”,
“ChangeTime”: “2015-02-05 15:07:10”,
“CreateTime”: “2012-09-04 10:05:48”
}, {
“ID”: “19”,
“FieldOrder”: “12”,
“ValidID”: “1”,
“InternalField”: “1”,
“Config”: {
“YearsInPast”: “5”,
“YearsPeriod”: “1”,
“DefaultValue”: null,
“YearsInFuture”: “5”,
“Link”: “”
},
“ObjectType”: “Ticket”,
“Name”: “ITSMDecisionDate”,
“FieldType”: “DateTime”,
“CreateTime”: “2012-09-04 10:05:53”,
“ChangeTime”: “2015-02-05 15:07:10”,
“Label”: “Decision Date”
}, {
“FieldOrder”: “13”,
“ID”: “21”,
“InternalField”: “1”,
“ValidID”: “1”,
“Name”: “ITSMDueDate”,
“ObjectType”: “Ticket”,
“Config”: {
“YearsInFuture”: “1”,
“YearsInPast”: “9”,
“YearsPeriod”: “1”,
“DefaultValue”: null,
“Link”: “”
},
“CreateTime”: “2012-09-04 10:05:53”,
“Label”: “Due Date”,
“ChangeTime”: “2015-02-05 15:07:10”,
“FieldType”: “DateTime”
}], “Notice”: “zammad migrator 1.0”
}

Thanks a lot! I created a Issue for it: https://github.com/zammad/zammad/issues/2375

Have a good time using Zammad :rocket:

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.