I have an issue with the EPDM API I cannot seem to solve. I'm trying to obsolete files through the ChangeState Method (IEdmFile5). I think I have the problem isolated now. I want to obsolete a pdf, which is part of the category "Documents".
Within this category there are three ways to go from a released file state to a Work in Process file state. The three transitions are called:
- Unlock for ECO (Project files)
- Unlock for ECO (Library)
- Unlock for ECO (BM)
Those different transitions relate to different locations in the vault, and the permissions are controller by user groups. When I am in the user profile "design engineer", I can only see the transition Unlock for ECO (Project Files) because that's my only permission.
As soon as I am in a user profile that can see more than one of those transitions, it becomes messy. Let's say I am a user that can see all three transitions by user privilige.
I am in location A when I right click a pdf. Location A is not part of the transition Unlock for ECO (Project Files). The Conditions for that transitions contains that the Filepath needs to be Location B.
EPDM gives me the option to select Unlock for ECO (Project Files) in location A even though I can never do something there that will render a result. I can select that transition, but the files do not meet the condition Filepath needs to be location B.
So the selectable transitions get filtered to your RMB context menu through user rights, but not through the conditions.
The actual issue; ChangeState does not work when I have more than 1 transition as an option to reach a new state. When I have a profile that can see only 1 transition, the script works. When I see multiple transitions, it does nothing, but also does not throw an error.
That makes me think that it selected the wrong transition for the file, rendered no valid files in it's solution and went ahead like nothing happened.
I cannot specify which transition to use in the ChangeState method can I? Is there some other way to do this?
The help gives some extra info on something similar:
It is possible to create multiple workflows with two or more states having the same name. If poStateIdOrName contains the name of the destination state instead of its ID, and if several transitions from the file’s current state lead to new states all having the same name, SolidWorks Enterprise PDM randomly selects one of them. To be sure to which state the file transitions, specify a state ID in poStateIdOrName.
But that's different from my situation as in my problem lies in the transitions.
I have experimented intensively with the syntaxes here. By Going into the current state, and figuring out all potential next states, with the ID's, but the ID of the target is the same ID all the time.
oObsoleteFile.ChangeState("Work in Process", sub_folder_pdf.ID, "", 0, 0);
oObsoleteFile.ChangeState(targetState.ID, sub_folder_pdf.ID, "", 0, 0);
I can't find any info on the internet for what to do with this problem, so does anybody here have an idea? Can I control which transitions state the syntax needs to use?
oObsoleteFile.ChangeState(targetState.ID@[use_this_transition], sub_folder_pdf.ID, "", 0, 0); ?????
Any help would be greatly appreciated!!
Is this the right forum by the way?