Skip to main content
7-Bedrock
January 23, 2024
Question

Update WTUser

  • January 23, 2024
  • 3 replies
  • 2128 views

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 

3 replies

17-Peridot
January 23, 2024
  • 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());
7-Bedrock
January 23, 2024

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

17-Peridot
January 23, 2024

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

 

16-Pearl
January 23, 2024

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.

12-Amethyst
January 25, 2024

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