dynamicdan / sn-filesync

2-way sync ServiceNow field values to local files
MIT License
66 stars 37 forks source link

--resync overrides additional fields when js is first field for table #30

Closed i-kozlov closed 8 years ago

i-kozlov commented 8 years ago

Hello. The is problem (or may be it just not documented?).

For example i want to get ui_actions script & condition If set up config like this: "ui_actions": { "table": "sys_ui_action", "key": "name", "fields": { "js": "script", "condition.js": "condition" }, "subDirPattern": "table/client_<client>", "_custom": true }, on next --resync all *.condition.js files' content is overridden with content of UI action script. For example if i had 'Move Equipment.condition.js' and 'Move Equipment.js' both of them will have code of 'Move Equipment.js'.

Putting js field as last field solves the problem. So "ui_actions": { "table": "sys_ui_action", "key": "name", "fields": { "condition.js": "condition", "js": "script" }, "subDirPattern": "table/client_<client>", "_custom": true }, + --resync will get everything back to normal.

dynamicdan commented 8 years ago

Good finding. This happens when the same suffix is used multiple times. Then there is an "order race" issue. I've fixed this now by ensuring the more specific suffixes are processed first.