Skip to main content
1-Visitor
May 19, 2020
Question

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

  • May 19, 2020
  • 3 replies
  • 3205 views

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. 

3 replies

5-Regular Member
May 19, 2020

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

 

manglapr1-VisitorAuthor
1-Visitor
May 20, 2020

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

5-Regular Member
May 20, 2020

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.

22-Sapphire I
May 19, 2020

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.

18-Opal
June 9, 2020

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

manglapr1-VisitorAuthor
1-Visitor
June 24, 2020

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