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

Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X

Update WTUser

BA_10780502
5-Regular Member

Update WTUser

Hello All,

Is there any API which can help to update existing WTUser with another WTUser.

For Example, If john is one user who is part of many groups and change processes and he leaved the company now I want john should be replace with Max. All the existing task which was with john should be assigned to Max.

 

Thanks

 

 

 

@HelesicPetr 

8 REPLIES 8

  • API wt.workflow.work.WorkflowHelper.service.delegate(WorkItem, WTPrincipal) can reassign workItem to a new owner
  • Refer below code example
ObjectIdentifier oid = ObjectIdentifier.newObjectIdentifier("wt.workflow.work.WorkItem:319469");
WorkItem wi = (WorkItem) PersistenceHelper.manager.refresh(oid);
System.out.println("WorkItem Name: " + wi.getIdentity());
		
System.out.println(" Workitem Owner (Before delegate): " + wi.getOwnership().getOwner().getIdentity());
		
WTUser user = wt.org.OrganizationServicesHelper.manager.getAuthenticatedUser("shirish");
WTPrincipal principal = (WTPrincipal) user;
wt.workflow.work.WorkflowHelper.service.delegate(wi, principal); 

System.out.println(" Workitem Owner (After delegate): " + wi.getOwnership().getOwner().getIdentity());
BA_10780502
5-Regular Member
(To:Rocket_Max)

Hello @Rocket_Max ,

 

I don't want to use it for seprate Workitems .

 

I just want old user should get it replace everywhere inside windchill.(e.g Inside teams, roles and all change items)

 

Thanks

I don't see any similar records in the knowledge base...
Do you want to try "old user has been disconnected and reconnected to a new username" This seems to meet your requirements, but there are no similar records in the knowledge base either

Rocket__0-1705995826763.png

If you are testing, why not give it a try

 

Y.Driouchy
13-Aquamarine
(To:Rocket_Max)

that's the safest way to do it , all taken care by Windchill participant management tool.

otherwise, WTUser is the key table , if you know what i mean and up to the risks 😉

avillanueva
22-Sapphire II
(To:BA_10780502)

I would recommend not customizing but using the tools and reports to help complete your job. Hopefully turnover for workflow recipients is infrequent. First off, immediately go in and delegate any future task but using the user's calendar. As admin, you can do setup an indefinite delegate. Next, create a query builder report that can display any context team roles that this user is a member of. There is a feature in the context team that will replace a user with another user and handle any open workflows. If there are not too many places, it should not take long. Next there is groups. There should be no replacement as I would suspect the other user is already a member but this is simply an remove/add operation. 

avillanueva
22-Sapphire II
(To:avillanueva)

I am living your life. I pulled all user membership and groups in a report to take a quick look.  There were 600+ entries of users in Product roles/groups of users that are deleted.  Far to many to clear manually unless I want to block a good portion of a day.  I know I can take care of many in one shot on a context team page but its still tedious work. If I come up with something, I will share. For now, its burning that report to 0.

TDT
12-Amethyst
12-Amethyst
(To:BA_10780502)

Hi @BA_10780502,

write a utility to get all the tasks assigned to user a and replace with user b if its a one time activity.

Or If its a repetitive activity implemented a wizard in UI to input the old user and new user details.

The best practice is to ask user the user to reassign all the tasks before leaving the organization.

Hi ,

 

Interesting question

you can manage the Team members base on Roles and Groups via then adding and removing delegation it better,

and base on workflow the task automatically assign to delegate or replaced users.

and im not sure for this API tools

 

Thank 

Sarathkumar M

Sarathkumar M
Top Tags