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

Calls for Organization-tree SD 4.5

SOLVED
Go to solution
Highlighted
Pontus Sjöö
Occasional Advisor

Calls for Organization-tree SD 4.5

Hi!

Using these forums I've found a solution to a customers request of IT-managers using service pages to view their organizations service calls. Unfortunately I don't saved the link for the solution I went for but with that as an example and then the webAPI examples I got what was needed.

Now however I'm stuck. The customer has a organization tree which has some managers that needs to see the whole tree's service calls.

It's not a multilayered organization but one big umbrella parent and several children. Each manager is part of one of the children.

It sounds easy to first check if the organization has a parent and then add that and all corresponding children to that organization to the service call filter. The problem is, I cannot get it to work. My limited knowledge in java is not helping.

Any tips? Or even better, is there anyone who can make a small script example on how to find the parent organization of a person and then loop through all children and add it to a filter?
4 REPLIES
Vasily Kamenev
Honored Contributor
Solution

Re: Calls for Organization-tree SD 4.5

HI
the parent org you can get by next code:
long oid;
ApiSDSession session = ApiSDSession.openSession("", "", "");
IPerson person = session.getPersonHome().openPerson(oid);
IOrganization org = person.getPersonOrganization();
IOrganization orgP = org.getParentOrganization();

Vasily
Pontus Sjöö
Occasional Advisor

Re: Calls for Organization-tree SD 4.5

Perfect, Thank you Vasily!

I'll post my example for others as soon as I've implemented everything!
Pontus Sjöö
Occasional Advisor

Re: Calls for Organization-tree SD 4.5

I continued on the solution posted elsewhere on these forum and applied some changes to make it work with parent/childs.

I have not made the script work with childrens children but that would be simple enough anyway.

Best way would be to build a function and call that function for each organization you face. All that after you've identified the top parent organization of course.
Pontus Sjöö
Occasional Advisor

Re: Calls for Organization-tree SD 4.5

Closing thread
//Add this to "OnDomLoad" event