This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

DEVELOPERS FORUM - Workflow Launch Example Using It Another Item Type

jsnosal - Thursday, April 18, 2013 4:15 PM:

I'm working on implementing the the workflow launch example into a new item type that I have created. I have changed the method to point to the workflow. Everything looks to be setup correctly. When I click the launch workflow button and then click save, I get an error saying Aras.Server.Core.ItemIsLockedException. Any ideas on what is causing this error? Thank you for your help. 

Josh



fli - Friday, April 19, 2013 7:21 AM:

Hi Josh,

 

Try to test the locked state of your item after your "launch workflow button" -method has run, see if it has the locked state you expect. 
You can also test this by doing a std. search for the item, here you can see either the lock or not.
 my guess is that the item is locked when you try to save it?
Regards Christoffer 

 



jsnosal - Friday, April 19, 2013 9:47 AM:

Christoffer,

Yes the issue is when I click the launch workflow check box and then click save. If I uncheck the launch workflow box, I can save and unlock like normal. The only things I changed in the method are which action and which workflow to point to. The workflow launch example works great. Below is the method that I'm using. I'm not sure what I'm overlooking. Thank you for your help. 

 

' Workflow Launch Example

' Demonstrates the launching of a workflow from a server event

 

' Continue only if the launch_workflow property is set to true or if the method was called from the Action

If (Me.getProperty("launch_workflow","0") <> 1 AndAlso Me.getAction() <> "Deviation Workflow Launch") Then

 Return Me

End If

 

' Find the Workflow Map

Dim inn As Innovator = Me.newInnovator()

Dim wflMapName As String = "Deviation Workflow Launch"

Dim wflMap As Item = inn.getItemByKeyedName("Workflow Map",wflMapName)

If wflMap Is Nothing Or wflMap.getID().Length <> 32 Then

 Return inn.newError("Unable to retrieve Workflow Map '" & wflMapName & "'")

End If

 

' Instantiate and start the workflow

Dim wfl As Item = Me.instantiateWorkflow(wflMap.getID())

If wfl.isError() Then

 Return inn.newError("Error instantiating workflow: " & wfl.getErrorDetail())

End If

wfl.startWorkflow()



jsnosal - Monday, April 22, 2013 9:35 AM:

I found out what my issue was. I had a workflow promotion inside the first step of the workflow. Therefore it was trying to change the Lifecycle state and that cant be done unless the item is unlocked. 

 

Josh