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

Any experience with SD4.5 Web API and IGenericRelation

Highlighted
itsmmdc
Occasional Contributor

Any experience with SD4.5 Web API and IGenericRelation

Has anyone created any Web-API code for interogating Service Calls and Generic Relations.

Any code will do, it may just save me a little time - Thats if you dont mind sharing.

Thanks
2 REPLIES
William_157
Senior Member

Re: Any experience with SD4.5 Web API and IGenericRelation

manu_
Regular Collector

Re: Any experience with SD4.5 Web API and IGenericRelation

Hi,

here his a small code to get generic relations from a service call:

ApiSDSession session = null;
try {
session = ApiSDSession.openSession(server, username, password);

} catch (RuntimeException e) {System.out.println(LogIt("Error opening a session : " + e.getMessage());)}

IServicecallHome homeSC=null;
IServicecall SC=null;
Long oid;//to be set up

homeSC=session.getServicecallHome();
SC=homeSC.openServicecall(oid);

IGenericRelation[] GRSC=SC.getIncomingGenericRelations();

for (int i=0;i{
System.out.println(GRSC[i].getOID()); //or anything you like
}

And then you have all the generic relations related to the SC. Does it help ?

Regards.
//Add this to "OnDomLoad" event