Workflow set state
I have a workflow that is used on almost all of our parts. One of the functions of this workflow is to set the states of the promoted items. It works correctly a majority of the time. Sometimes though, it doesn't. The windchill logs seem to tell me that the workflow is trying to set state on items in a user's workspace which of course it can't. I don't know why it is even looking at workspaces.
We have tried multiple things to fix this. The following code is what we use to set state of the promoted items depending on document type (wtpart, epmdocument, wtdocument). IMPLEMENTATION is a valid state for the promoted items.
wt.lifecycle.LifeCycleHelper.service.setLifeCycleState(theLatestPart, wt.lifecycle.State.toState("IMPLEMENTATION"),false);
wt.lifecycle.LifeCycleHelper.service.setLifeCycleState(theLatestPart, wt.lifecycle.State.toState("IMPLEMENTATION"),false);
wt.lifecycle.LifeCycleHelper.service.setLifeCycleState(theLatestDoc, wt.lifecycle.State.toState("IMPLEMENTATION"),false);
We have also tried the following with the same results:
wt.lifecycle.LifeCycleServerHelper.service.setState(lifeCycleManaged, wt.lifecycle.State.toState("IMPLEMENTATION"));
Below is an example of the error that shows up in the logs.
2020-08-17 10:20:06,064 INFO [WfPropagationQueue.PoolQueueThread-22603] wt.system.err Administrator - (wt.lifecycle.lifecycleResource/143) wt.lifecycle.LifeCycleException: An object stored in a personal cabinet can not have it's state changed. Move the object to a shared location before attempting the Set State.
We do know that if we remove the item from all workspaces the workflow will set the state successfully. If we revise the item in commonspace it works also because the newest revision doesn't exist in any workspace.
Does anybody have any ideas why this is happening?
Thanks,
Matt

