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

Attachment to service call

Highlighted
Anwar Dawood
Occasional Advisor

Attachment to service call

Hi,

can any one tell me how to add a attachment to service call using web-api
4 REPLIES
Dusko Milosevic
Regular Collector

Re: Attachment to service call

You can use the "Update XXXX" e-mail command to add attachemnt in service call number XXXX. There is no other way to add attachment if you don't have a client installed.

Dusko
Anwar Dawood
Occasional Advisor

Re: Attachment to service call

hi

Dusko, i didnt catch your points, actually i want to add an attachments to service call through Java Program (using HPSD WEB-API). While adding attachment it throws NullPointerException. please see the code below

// Getting Service call
ApiSDSession objSession = ApiSDSession.openSession("xxxxxx","yyyyyyy","zzzzzzzz");
IServicecallHome objSerHome = objSession.getServicecallHome();
IServicecallWhere objSerWhere = objSerHome.createServicecallWhere();
objSerWhere.addCriteriumOnID(new Long("123456"));
IServicecall objSer[] = objSerHome.findServicecall(objSerWhere);

// Adding Attachments
IAttachment objAttachment = objSer[0].getAttachment();
IAttachedItemHome objAttItemHome = objSession.getAttachedItemHome();
IAttachedItem objAttachItem = objAttItemHome.openNewAttachedItem();
objAttachItem.setFilename("test.txt"); // This file is available in the same folder where the program gets run

objAttachment.addAttachedItem(objAttachment); // In this line i am getting NullPointerException

objAttachment.transfer();
objSer[0].save();

Shamsudeen1
Acclaimed Contributor

Re: Attachment to service call

Hi anwar

how you solved this issue. I am also facing the same problem

Shamsudeen1
Acclaimed Contributor

Re: Attachment to service call

Hi Anwar. You want to post the file to hpsd server before trying to attach

//Add this to "OnDomLoad" event