hi @BjoernRueegg ,
I have use case while create Part need to move different folder i am using
managerService.addEventListener(partListMoveListener, PersistenceManagerEvent.generateEventKey(PersistenceManagerEvent.POST_STORE));
//for move
wt.folder.FolderHelper.service.changeFolder((wt.folder.FolderEntry) part, folder);
but getting Error ""Cannot move XXXXX because Object "XXXXXX" must be assigned to a folder"". I checked target folder is coming with destination folder.
please help on that
Reference topic: https://community.ptc.com/t5/Windchill-Customization/How-to-listen-to-event-while-moving-object-from-one-container-to/m-p/876767#M1828
Solved! Go to Solution.
@AA_9841156 I haven't tried it while creating a new object. Have you turned the logger on? Perhaps you can't listen to the event since it is not a move while creating a new part. Also, you need to make sure that a later event won't override your made changes.
wt.services.verbose=true
wt.services.verboseEvents=true
Since it is a new WTPart it could be that you can set the context and folder within the NEW_VERSION event. See also CS164007
Just my thoughts.
Hi @AA_9841156,
Is there any reason not to set the target folder using OIR?
Why do you want to use Listeners?
Hi @TDT ,
Actually i have to move part once created, to related service container . but for time being i just checked same container but different folder.
The OIR is working only within same context , if object need to be moved to another prod/Library OIR won't help
Hmmm,
I just wrote a listener to detect a move. Upon move I print a message to state what got moved and to where.
It's works as expected.
MS LOG reads:
2025-06-19 08:05:15,761 INFO [ajp-nio-127.0.0.1-8010-exec-7] wt.system.out wcadmin -
2025-06-19 08:05:15,761 INFO [ajp-nio-127.0.0.1-8010-exec-7] wt.system.out wcadmin - You just moved Document - 0000000028, Testing, A.2 to /Default/Testing/Testing. Now what?
And then I move it back to its original folder.
MS LOG now reads:
2025-06-19 08:45:23,460 INFO [ajp-nio-127.0.0.1-8010-exec-7] wt.system.out wcadmin -
2025-06-19 08:45:23,460 INFO [ajp-nio-127.0.0.1-8010-exec-7] wt.system.out wcadmin - You just moved Document - 0000000028, Testing, A.2 to /Default/Documents/Testing. Now what?
It works as expected. Not sure what you want to do upon move, you never stated that 🤷♂️, but the listener definitely works.
Actually my requirement is if Part or PartList created so as per OIR that object will be store mentioned folder as mentioned in OIR. once object created I want to move that object to respective service container to different folder.
that use case i am trying with Listener POST_STORE event but not able to do it.
So, OIR has nothing to do with this.
You just want to move the part somewhere after it’s created. Very doable but how do you know which container/folder to move the part to? 🤷♂️
What’s the logic you are using to determine the new location?
I have this working.
My listener will put the WTPart in a folder upon creating the part.
Note the UI has the location set to a folder named Documents.
My listener however will make sure the part is in a folder named Parts during the creation process.
Upon creation we can see the part in in the Parts folder.
@AA_9841156 you still have not responded with the logic to determine which Container/Folder you are using the determine where the part should be located but rest assured it is doable.
Hi @d_graham ,
Actually in our System we have Service container for all container and having folder template as well .So when part is created i am trying to getting container for Part and find related Service container and then desired folder wherever i want.
that is not big deal .
What ever you did i think it will work for me could please share your code in ZIP file here.
@AA_9841156 I haven't tried it while creating a new object. Have you turned the logger on? Perhaps you can't listen to the event since it is not a move while creating a new part. Also, you need to make sure that a later event won't override your made changes.
wt.services.verbose=true
wt.services.verboseEvents=true
Since it is a new WTPart it could be that you can set the context and folder within the NEW_VERSION event. See also CS164007
Just my thoughts.
Thanks @BjoernRueegg for sharing your thoughts and this thoughts hit the solution super.. 😊
Its working as per expectation.