The community will be in read-only from Monday 11:59pm (PT) to Wednesday 7:30am (PT)
The community will be in read-only from Monday 11:59pm (PT) to Wednesday 7:30am (PT)
Service Desk Practitioners Forum
cancel
Showing results for 
Search instead for 
Did you mean: 

How to get Workgroup name using API?

SOLVED
Go to solution
Highlighted
Nirad
Regular Collector

How to get Workgroup name using API?

Hi Friends,

I am learning SD web API. I am using web API javadoc as referance to design JAVA class.

But sometimes it is very difficult to find out exact mathod ot interface from the material which will give you the required output.

I am using blow code to get assigned workgroup man but it is giving me null.

IServicecallHome servicecallHome = session.getServicecallHome();

IServicecall servicecall = servicecallHome.openServicecall(ticketId);

IWorkgroup wg =servicecall.getServiceCallWorkgroup1()

I will appreciate if somebody guide me on this.
5 REPLIES
danbiscuit
Super Collector

Re: How to get Workgroup name using API?

If you are just using 'wg' to get the value of the workgroup name, then it will not work.

You need to call the Name using the following:

wg.getName();

This will return the workgroup name as a String.
Nirad
Regular Collector

Re: How to get Workgroup name using API?

Thanks a lot for quick reply but i was using wg.getName() to retrive the workgroup name.

But if some value is there then wg object should print some long character. right? but it is printing null

Any way, when i am using wg.getName() then also it is giving null.

I have cross checked that ticket has workgroup name assigned which i am trying to read.

Please advice further.

Thanks once again.
Gerry Allardice
Honored Contributor
Solution

Re: How to get Workgroup name using API?

IWorkgroup wg =servicecall.getServiceCallWorkgroup1() would be giving you the extra custom workgroup field on servicecall.

You need to open up the assignment object and get the To Workgroup Name. Assignment is an object in its own right. Have a quick peek at ViewEditServicecall.jsp in the servicepages and you will probablly see this in action.

Regards
Gerry
Vasily Kamenev
Honored Contributor

Re: How to get Workgroup name using API?

HI
Are you not did mistake? this is a custom field request.
Perhaps you like Assignment ?serviceCall.getAssignment().getAssWorkgroup()

Vasily
Nirad
Regular Collector

Re: How to get Workgroup name using API?

Thanks to Gerry and Vasily for giving me following solution.

Gerry has given me the solution with the approch we should use to get some answers very quickly by yourself.

Gerry's Answer: You need to open up the assignment object and get the To Workgroup Name. Assignment is an object in its own right. Have a quick peek at ViewEditServicecall.jsp in the servicepages and you will probablly see this in action.

Vasily has provides direct solution to my question as explained below

IWorkgroup wg = serviceCall.getAssignment().getAssWorkgroup()

String workgroup = wg.getName();

Thanks a ton to both of you as you open new direction to my thinking of service pages interfaces.
//Add this to "OnDomLoad" event