Service Desk Practitioners Forum
cancel
Showing results for 
Search instead for 
Did you mean: 

how to copy attachment from a service call to a work order?

Highlighted
Vova Ivanov
Occasional Advisor

how to copy attachment from a service call to a work order?

how to copy attachment from a service call to a work order?
10 REPLIES
George M. Meneg
Honored Contributor

Re: how to copy attachment from a service call to a work order?

Drag and drop ?
menes fhtagn
Vova Ivanov
Occasional Advisor

Re: how to copy attachment from a service call to a work order?

No, I had in view of that it is necessary to organise investment transfer at creation of the  work order from the service call as, for example, it occurs at transfer of fields ' the declarant, the short description'
Vova Ivanov
Occasional Advisor

Re: how to copy attachment from a service call to a work order?

No, I mean we need to make the attachment transfer while creating an work order in a service call as it happenes for example in "applicant" and "short description" areas
Vasily Kamenev
Honored Contributor

Re: how to copy attachment from a service call to a work order?

Hi.
Vladimir, u task required programming.
1. need read attachment
2. need registered attachment in WO
3. need create folder structure for attachment
4. need transfer attachment(copy) to new place
The easy way use web-api.

Vasily
KMR_1
Acclaimed Contributor

Re: how to copy attachment from a service call to a work order?

"read attachment" - seems to be easy... but I can't find how to read attachment by web-api.

Example code:
IServicecallHome scHome = session.getServicecallHome();
IServicecall call = scHome.openServicecall();
IAttachedItem[] AttachedItems = call.getAttachment().getAttachedItems();

And this is only a list of attachment's names (AttachedItems[0].getBaseName() or AttachedItems[0].getFileName()) but how to read contens of one of this files?
The Pike
Honored Contributor

Re: how to copy attachment from a service call to a work order?

Never have used it but, have you tried openAttachedItem?
KMR_1
Acclaimed Contributor

Re: how to copy attachment from a service call to a work order?

Yes of course this was my first check. SD response is something like "You are not allowed to view this..."
But in the meantime I've found so in generally, ftp path and attachment's file name are they OID's. Not exactly, so creating full ftp path seems a little tricky (SD 4.5 SP29).
Maybe there is any other or better method to get full ftp path to attachment?
Vasily Kamenev
Honored Contributor

Re: how to copy attachment from a service call to a work order?

Hi
you need convert oids (servicecall and attachment) to uuid. Read that:
The new folder structure is constructed as following:


\Attachmentroot\Entitytype-name\Entity-uuid-fragements1...11\Attachment-uuid
UUID (Universally Unique Identifiers) is generated from object OID. It is 128 bits (16 bytes) long. Entity-uuid-fragements1...11 represents breaking entity uuid into 11 fragments. The first ten fragments are 3 bytes long each and the last fragment is 2 bytes long.

Entity-uuid is generated from entity OID and Attachment-uuid is generated from attachment OID. Attachment-uuid uses the following format (where H is a hexadecimal number):


HHHHHHHH-HHHH-HHHH-HHHH-HHHHHHHHHHHH
In new attachments folder structure, a Service call attachment path will be like:


Attachmentroot\Servicecall\000\000\000\000\000\000\010\000\c31\100\fa\00000000-0000-0000-0001-0000c6280140

After you can read file by any method using url.
But Web-api having bug and copy possible only on local machine. That mean if you will doing that remotely, you will got error.

Vasily
KMR_1
Acclaimed Contributor

Re: how to copy attachment from a service call to a work order?

Hi Vasily,
many thanks for answer - this confirms my observations, but I've 2 more questions:
1. is there in web-api any utility function to convert OID -> UUID
2. UUID's like You show in your answer are SP-independent (I've SD 4.5+SP29 and my paths to my attachments are in this form but what if I'll connect to SD 4.5+SP20)

Regards,
Chris
Vasily Kamenev
Honored Contributor

Re: how to copy attachment from a service call to a work order?

Hi
Attachment help you.

Vasily
//Add this to "OnDomLoad" event