AnsweredAssumed Answered

Change State Error

Question asked by Pichaiyan Prabaharan on Nov 10, 2020
Latest reply on Nov 17, 2020 by Pichaiyan Prabaharan

Hi I tried to write a code that change file from 1 state to another state. But I got below error. Please someone help to resolve this.

 

 

My Code is Here,

 

For Each AffectedFile As EdmCmdData In ppoData

Dim btnVault As IEdmVault16 = TryCast(poCmd.mpoVault, IEdmVault16)
Dim btnFile As IEdmFile13
Dim btnFolder As IEdmFolder9
Dim btnCurrentStateID As Integer = Nothing
Dim btnCurrentStateName As String = ""
Dim btnDestStateName As String = "Revision Up"
Dim btnDestStateID As Integer = Nothing
btnFolder = btnVault.RootFolder
btnFile = btnVault.GetFileFromPath(AffectedFile.mbsStrData2)
btnCurrentStateID = btnFile.CurrentState.ID
btnCurrentStateName = btnFile.CurrentState.Name

If Not btnFile.IsLocked Then
Try
MessageBox.Show("This is checkedout! " & AffectedFile.mbsStrData2)

btnFile.ChangeState3(btnCurrentStateID, btnDestStateName, btnFolder.ID, "RevUp", Process.GetCurrentProcess.SessionId, EdmStateFlags.EdmState_Simple, "Qwerty")

Catch ex As Exception

MessageBox.Show(ex.Message)
End Try

Else
MessageBox.Show("This is checkedout! " & AffectedFile.mbsStrData2)
End If

Next

 

What I tried,

   1. I tried with "from" state name and "To" state name.

   2. I tried to change both state name to ID. But I successfully able to get current state Id and I don't know how to get          destination state ID.

   3. I checked both state permissions and workflow permissions.

 

Thanks in advance

Outcomes