Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X
I have a requirement where if I add a specific type of WTPart to existing Part in Part structure using OOTB actions "add existing"/"add new", the Parent part to which I want to add child part should not iterate. For this I have implemented listener and catch the PRE_STORE event and could found the target object which is WTPartUsageLink. From this I got both roleA and roleB objects, and then I undo check out the roleA (parent) and then created an usagelink and finally tried to save it using PersistenceHelper.manager.insert() API
Here the issue is probably in back end after PRE_STORE , there is PRE_CHECKIN event that might be calling so I am getting exception that unable to find the checked-out copy. Here there will not be any working copy because I undo check out it using WorkInHelper.. API.
My overall intension is that parent part should not iterate but need to create usagelink by adding a child part (of specific type).
Note: This I need only when I am trying to add a specific type of part which will not involve any release. I have an option in my mind of creating custom action followed by implementing custom Form Processor, however, I want to know the feasibility of using existing OOTB actions by implementing listeners.
Can anyone help me out for this? Thanks in advance
Hi @TDT ,
The part which we would like to add in part structure is of specific type which will not be go for production release to any plant. This is just to add some information to existing parent part. So I just want to know the feasibility if we can achieve this with OOTB actions itself
Without iterating is against Windchill specs, he only way is to go through SQL and do an insert into WTPartUsageLink
table, but this not really supported .
@Fadel ,
I just wrote code using only APIs (no SQL dB insert was used) to add a Part to structure without iterating the parent part.
Here's parent part before. Note version A.1
I run code in Windchill shell.
I refresh structure page and we see
0000000034, test 1, A.1 now uses 0000000035, test 2, A.1
0000000034, test 1, A.1 was NOT iterated.
I did get this to work in the UI using only supported APIs. No SQL was used.
I used the Insert Existing option and added a new part without iterating the parent part.
I add the new part.
Then I refresh the page, and we the new part is in fact added to the structure of A.1. 😊
So, it is doable to add a new part to structure in the UI without iterating the parent part.
Is the part automatically checked in as A.1 , if yes this a BUG , the A.1 may be already sent to ERP with 1 usage link , and adding another usage with no iteration may create inconsistencies between PDM and ERP ,
No, it is NOT automatically checked in as A.1.
@AKC wants to add a child part to the part’s structure without iterating the part. That’s exactly what I did.
I don't really follow you , initially the part was A.1 checked in , then insert existing checks the A.1 out second screenshot .
then on the third on we have 2 usages and A.1 checked in ,I'm not sure how you got A.1 back checked in without moving to A.2 ?
@Fadel ,
@HelesicPetr is correct.
It’s a trick I developed when I first had a request to do whatever without iterating while still using supported APIs.😁
Hi @AKC,
I wanted to see if you got the help you needed.
If so, please mark the appropriate reply as the Accepted Solution. It will help other members who may have the same question.
Of course, if you have more to share on your issue, please pursue the conversation.
Thanks,
Anurag