Workflow Promotion

rated by 0 users
This post has 2 Replies | 2 Followers

Top 50 Contributor
Posts 36
Points 425
Yelena Posted: Wed, Feb 7 2007 3:27 PM

Could you suggest the method that I can use to promote to the Lifecycle state from workflow activity. e.g:. when item moves to “Review” activity on the Workflow, the Lifecycle state changes to “Mgt. Review” state, etc. Can I use Workflow Promotion method. What should I change?

Thanks,

Yelena
Top 10 Contributor
Posts 241
Points 2,655

Hi Yelena -

Welcome to the forums.  Your best bet to achieve an automatic lifecycle promotion from workflow is to reuse the "Workflow Promote" method.  This method is included with the PE solution, but is written to work generically for these purposes.  To use it, first attach the method to the Activity Template (the "Review" activity in your example) as an OnActivate server event.  Next, you need to create a mapping between the workflow activity and the desired lifecycle state.  To do this, create a new Workflow Promotion item and choose the correct activity and state (note that choosing the right activity can be a little tricky if you have many with the same name -- you can rename the activity you want to something like "Choose Me", then change it back after you've created the Workflow Promotion).

We have a simpler way to do all this in the works (no methods required), so stay tuned for updates.

Rob 

  • | Post Points: 0
Top 10 Contributor
Posts 178
Points 1,240
SamsAn replied on Fri, Feb 23 2007 3:45 AM

Just the addendum to the Rob's comment. The onActivate Review activity method (location=Server, type=VB) can be implemented as below.

Dim myInnovator As Innovator = Me.NewInnovator()
Dim qry As Item
Dim res As Item

' Get the Workflow Process id
qry = Me.newItem("Workflow Process Activity","get")
qry.setProperty("related_id", Me.getId()) 'related item is the activated activity
qry.setAttribute("select", "source_id")
res = qry.apply()
If (res.isError()) Then Return myInnovator.newError("The Workflow Process item cannot be found: " + res.getErrorDetail())

' Find the Workflow relationship corresponding to the Workflow Process (and thus to the source item)
qry = Me.newItem("Workflow","get")
qry.setProperty("related_id", res.getProperty("source_id"))
qry.setAttribute("select","source_id,source_type")
res = qry.apply()
If (res.isError()) Then Return myInnovator.newError("The Workflow relationship cannot be found: " + res.getErrorDetail())

' Get the source item (it has to be promoted to the required state)
qry = Me.newItem(res.getPropertyAttribute("source_type","keyed_name"),"get")
qry.setId(res.getProperty("source_id"))
qry.setAttribute("select","id, state")
Dim sourceItem As Item = qry.apply()
If (sourceItem.isError()) Then Return myInnovator.newError("The source item cannot be found: " + sourceItem.getErrorDetail())

' Promote the source item
Dim toState As String = "Mgt. Review"
If (sourceItem.getProperty("state") <> toState) Then
 sourceItem.setAction("promoteItem")
 sourceItem.setProperty("state",toState)
 res = sourceItem.apply()
 If (res.isError()) Then Return myInnovator.newError("The promotion to state " + toState + " is failed: " + res.getErrorDetail())
End If

  • | Post Points: 5
Page 1 of 1 (3 items) | RSS