cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Updating user details in Windchill

SOLVED
Newbie

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?

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Updating user details in Windchill

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>

View solution in original post

2 REPLIES 2

Re: Updating user details in Windchill

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>

View solution in original post

Re: Updating user details in Windchill

Hello Binesh, As email field also sits in Windchill DS, It doesnt look like the API will update that, any thoughts?

Announcements
LiveWorx Call For Papers Happening Now!