Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X
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.
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
I am getting "1084_ORG" entity multiple times while fetching group , this entry coming nearly 100th times though groups for user are 3 only.
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.
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.
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
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
Thanks for the solution. Could you please share the query you have used?
-Shankar