I would like to know if it is possible to run PDM task addin before or after auto transition state.
CAD files are in WIP state. Next state is “Update Custom Properties” and the final state is “Design Review”. When user moves the files to update custom property state, addin checks out parts and assembly files, updates some custom properties and checks them back in. Files then automatically transition to design review state so that someone can review the design. The use does not have permission to check out files when files are in design review state and I would like to run the addin on user machine so would like to use existing logged in user during the task addin. Hope I have explained it well enough.
You need to add a superuser setting to your add-in since you do not want to mess up the workflow.
This is really funny but I have just finished implementing this on an add-in.
After the PostStateChange, you spin up a new thread where you log into the vault with the superuser credentials, do what you need to do and then abort the thread.
Do not pass any API objects from the main thread to the work thread. You can pass the file ID, the folder ID and the probably the object value you are trying to set.
Hope this makes sense!
If I understood you correctly, this is what I can do:
- Do not create intermediate state called “Updated Custom Properties”.
- User moves the files to “Design Review” state manually from WIP state.
- Use PostStateChange hook in the addin to check out files, update custom properties and check them back in using superuser credential after files are moved to design review state.
Yup. Let me know if that works.
I will give it a try over the weekend and let you know.
Sorry mate, I didn’t get change to test it yet. I will update the post as soon as I get some testing done.