Skip to main content
May 19, 2020 9:24 AM UTC
Question

fetch group detail for user , in how many groups user is included.

Hi,

 

I tried to fetch group info from user , but i am getting unwanted results apart from the group name for that user.I have used below api :-

 

user.parentGroups(false);

Does anyone have any idea why this api is not returning exact group info which is present for that particular user.

 

Thanks in advance. 

7 replies

May 19, 2020 1:49 PM UTC

What is the undesired info you are getting back, when you use this?

 

This is in regards to this knowledge article:

https://www.ptc.com/en/support/article/CS50075

 

So you might want to check that, and perhaps open a Support case to ask about the API call here, to confirm its usage.

 

Mike

 

manglaprAuthor
May 20, 2020 8:40 AM UTC

I am getting "1084_ORG" entity multiple times while fetching group , this entry coming nearly 100th times though groups for user are 3 only.

May 20, 2020 1:15 PM UTC

Are you getting a "WTContext nesting not allowed" exception too, with this?

Like I mentioned, you will probably want to open a Support case for this one.

May 19, 2020 3:29 PM UTC

This has been requested by pretty much every Windchill admin in the entire life of Windchill.

User membership in Group(s) is stored in Windchill DS, not in the database, so queries to the database cannot present it.  Major hassle to go to every Group one by one.

The fact that Group membership is presented in the UI shows that a query can of course be executed, but it is not exposed to admin's trying to manage user accounts.

It has been requested many times; may as well submit an idea for it again.

Jun 9, 2020 2:15 PM UTC

To get group info for a user I do the following:

 

1. Create a QuerySpec that finds all WTGroups

I filter as required.  For example, exclude internal groups or exclude disabled groups or whatever

FYI, Group 128876_ORG is an "internal" group so maybe exclude internal groups

 

2. Create a List<WTGroup>

 

3. Go thru the QueryResult from step 1 and use group.isMember(<the user in question>) 

if isMember() returns true add the group to a List<WTGroup>

 

3. Do whatever with the List of groups the user is a member of.

 

Hope this helps.

 

David

manglaprAuthor
Jun 24, 2020 7:50 AM UTC

Thanks for the solution. Could you please share the query you have used , i really did not get how can we add exclude and include in group query.

 

Best Regards,

Priya Mangla