Updating user details in Windchill
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Updating user details in Windchill
i would like to update 300 email ids of users in windchill so is there a way to do it other than manually doing it for each account?
Solved! Go to Solution.
- Labels:
-
Other
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
There are several ways of doing it.
1. Java API, write a utility to update the email
try {
QuerySpec qs = new QuerySpec(WTUser.class);
qs.appendWhere(new SearchCondition(WTUser.class, WTUser.EMAIL, SearchCondition.LIKE, "oldemail@oldemail.com", true), null);
QueryResult qr = PersistenceHelper.manager.find((StatementSpec) qs);
while (qr.hasMoreElements()) {
WTUser user = (WTUser)qr.nextElement();
user.setEMail("someone@something.com");
PersistenceHelper.manager.save(user);
}
} catch (WTException | WTPropertyVetoException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}}
2. Update WTUser database table, email field
3. Use infoengine Webject
<%@page language="java"%>
<%@taglib uri="http://www.ptc.com/infoengine/taglib/core" prefix="ie"%>
<ie:webject name="Get-Properties" type="MGT">
<ie:param name="AUTHORIZATION" data="${@SERVER[]authorization[]}"/>
<ie:param name="ATTRIBUTE" data="wt.federation.ie.VMName"/>
<ie:param name="GROUP_OUT" data="properties"/>
</ie:webject>
<ie:webject name="Update-Objects" type="ACT">
<ie:param name="INSTANCE" data="$(@FORM[]supporting-adapter[*])" delim="!" valueSeparator="!" default="<%=com.infoengine.au.NamingService.getVMName()%>"/>
<ie:param name="INSTANCE" data="${properties[0]wt.federation.ie.VMName[0]}"/>
<ie:param name="DBUSER" data="wcadmin"/>
<ie:param name="PASSWD" data="wcadminpasw"/>
<ie:param name="GROUP_OUT" data="Users"/>
<ie:param name="TYPE" data="wt.org.WTUser"/>
<ie:param name="FIELD" data="mail=someone@something.com"/>
<ie:param name="WHERE" data="uid=wcadmin"/>
</ie:webject>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
There are several ways of doing it.
1. Java API, write a utility to update the email
try {
QuerySpec qs = new QuerySpec(WTUser.class);
qs.appendWhere(new SearchCondition(WTUser.class, WTUser.EMAIL, SearchCondition.LIKE, "oldemail@oldemail.com", true), null);
QueryResult qr = PersistenceHelper.manager.find((StatementSpec) qs);
while (qr.hasMoreElements()) {
WTUser user = (WTUser)qr.nextElement();
user.setEMail("someone@something.com");
PersistenceHelper.manager.save(user);
}
} catch (WTException | WTPropertyVetoException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}}
2. Update WTUser database table, email field
3. Use infoengine Webject
<%@page language="java"%>
<%@taglib uri="http://www.ptc.com/infoengine/taglib/core" prefix="ie"%>
<ie:webject name="Get-Properties" type="MGT">
<ie:param name="AUTHORIZATION" data="${@SERVER[]authorization[]}"/>
<ie:param name="ATTRIBUTE" data="wt.federation.ie.VMName"/>
<ie:param name="GROUP_OUT" data="properties"/>
</ie:webject>
<ie:webject name="Update-Objects" type="ACT">
<ie:param name="INSTANCE" data="$(@FORM[]supporting-adapter[*])" delim="!" valueSeparator="!" default="<%=com.infoengine.au.NamingService.getVMName()%>"/>
<ie:param name="INSTANCE" data="${properties[0]wt.federation.ie.VMName[0]}"/>
<ie:param name="DBUSER" data="wcadmin"/>
<ie:param name="PASSWD" data="wcadminpasw"/>
<ie:param name="GROUP_OUT" data="Users"/>
<ie:param name="TYPE" data="wt.org.WTUser"/>
<ie:param name="FIELD" data="mail=someone@something.com"/>
<ie:param name="WHERE" data="uid=wcadmin"/>
</ie:webject>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hello Binesh, As email field also sits in Windchill DS, It doesnt look like the API will update that, any thoughts?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hello, BineshKumar1, please tell me how you can use the first option to add a new value to the table ( a new line)?
I created a separate topic on this issue https://community.ptc.com/t5/Windchill/How-do-I-add-new-values-using-QuerySpec/m-p/646594