dynamicdan / sn-filesync

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

Possibility to sync images #29

Closed Lesha-spr closed 8 years ago

Lesha-spr commented 8 years ago

Hi @dynamicdan ,

Is there a chance to sync images and related table?

Thanks, Oleksii

dynamicdan commented 8 years ago

That's an interesting question. What is the use case for downloading images?

Images are saved in the database and encoded. In theory one just needs to specify the jpg suffix in the config.json file and reference the column with the data. I haven't tried this out but you can and share your findings and we can see what works or not.

Lesha-spr commented 8 years ago

I want to be able to generate Sprite image (all icons in one file) on my local machine and sync it with the platform.

I can't find related column of the encoded image. There is just content information (i.e. Display Name, Created By and so on). I thought "Image" field is what I need but receive some hash string from this field and there is max_length=40 validation.

Another issue with this - images are validated to have their extension (.png, .jpg) on the "name" field so I have to rename file after sync.

P.S.: I'm new to SN so please be more specific if possible. Thank you in advance.

dynamicdan commented 8 years ago

The image sprite concept is an interesting one. I would not expect that you would need to create a sprite out of the existing out of the box images provided by SN. If you were say creating a CMS site then you might want to create a sprite for performance reasons but even then you would have the source images and use something like compass to generate the sprite for you.

In terms of the technical ability, if the image can be retrieved via JSON/XML using a standard SN API then we can do it. If not then we would need a custom web services interface to be written for the instance in question. Perhaps you can search the community for options. Note that I believe files are stored in the attachments table (sys_attachment_list.do). Trying to view one of these records causes the image to download. Security however blocked me viewing some rows even with rights so I assume some things are blocked.

dynamicdan commented 8 years ago

The option to download images is perhaps useful but I won't be able to invest time to support it. Feel free to fork this repo and "crack the code".