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

how do we attach a file to a service call using web-api?

Highlighted
Kenny Chang
Occasional Contributor

how do we attach a file to a service call using web-api?

Hi,

We are already able to generate a service call in the OVSD 4.5.
We know that there is a OID for a service call, and there are also OID(s) for attachment(s) that link with service call OID.

Our question is, is there a way for us to attach a file to a service call? (say, using web-api or something like that)

Any idea?
Thanks in advance.
3 REPLIES
S Ashok Kumar
Frequent Visitor

Re: how do we attach a file to a service call using web-api?

Just check if the following code helps:

IAttachedItemHome aHome = null;
IAttachment att = null;
aHome = session.getAttachedItemHome();
IEntityInfoHome entInfHome = session.getEntityInfoHome();
IEntityInfo entInfo = entInfHome.openEntityInfo(servicecall.getItemType());
att = servicecall.getAttachment();
IAttachedItem nItem = null;
nItem = aHome.openNewAttachedItem();
nItem.setParentEntityType(entInfo);
File f = new File("Filename to attach with path say /tmp/tmp.txt");
nItem.setFilename("Filename to attach with path say /tmp/tmp.txt");
nItem.setBaseName(f.getName());
att.addAttachedItem(nItem);
att.setAttachmentExists(new Boolean(true));
att.transfer();


- Ashok
E-mail: sakis4@gmail.com
Siekierko Przem
Super Collector

Re: how do we attach a file to a service call using web-api?

Have a look at the attached java file (taken form SD examples)
Kenny Chang
Occasional Contributor

Re: how do we attach a file to a service call using web-api?

thanks
//Add this to "OnDomLoad" event