How to copy attachments to an another table

Hello,

In SM 9,31 i have a need to copy attachments to a new  table. I have problem with coppying a data filed. In Java Script i simply doesnt get copied. This field in a new record is NULL. Im trying to do it like this:

...

oldAtt.data=newAtt.data

...

newAtt.doInsert()

 

note that oldAtt and newAtt has different ScFile so i cannot simply assign the whole record. Is there any way to copy the whole attachment to a different table?

  • Hello

    I don't think that this is possible and I don't know what will you do with this. but a little info on how this works.

    the attachments in each record whether its an interaction, change or whatever, the data of the attachment is not saved in the table of the module. each attachment is saved on the table sysattachment, which contains all of the attachments of the system and they are not saved like a normal record, they get saved fragmented, meaning that 1 attachment is divided into several parts and then stored in the database.

    hope this gives you an idea on how the system works and allows you to find another way for your problem 

    BR!

  • To copy it you should know that any attachments stored in SYSATTACHMENTS table.

    For example, for some attachment in interaction with incident.id=SD001 and file name is FILE001.jpg, in SYSATTACHMENTS table will be several records where:

    application=incidents

    topic=SD001

    filename=FILE001.jpg

    and field segment have value 0, 1,...

    So one attachment have several records in SYSATTACHMENTS table where the value in the segment field differs.