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 - how to write a method of Workflow with conditonal loop

krish80 - Thursday, January 29, 2009 3:20 AM:

i have created one workflow with conditional statement. Example: workflow stages START ,  A ,  B , C , D , END there are six stages. first i am giving condition

(1) if x>=99.99 the workflow will direct stage A to B

(or)

(2) if x>=90 && x<=95.99 the workflow will direct stage A to C 

(or)

(3) if x<=89.99 the workflow will direct stage A to D

 how to write the method for the workflow

Regards,

Krish 

 



Ronan - Friday, January 21, 2011 1:01 PM:

Hello,

I'd very much like advice too on the following cases:

  1. (Like Radhakrishnan), follow a specific transition (A->B or A->C) depending on a workflow variable defined at step A
  2. Follow a specific transition (A->B or A->C) depending on a Property of the Item governed by the workflow 
  3. Direct Assignment G to IdentityXYZ, where IdentityXYZ is defined as a variable at step F of the workflow
  4. Direct Assignment G to IdentityXYZ, where IdentityXYZ is defined in the Item governed by the workflow
  5. (Similar to 4) Direct Assignment G to IdentityXYZ, depending on a Property of the Item governed by the workflow

Any hint / feedback / suggestion / magic potion will do, I'm kinda helpless... Thanks for your help.



Ronan - Monday, January 24, 2011 9:09 AM:

Found the "Workflow Automation Examples" community project, which contains such samples.

No specific methods actually, it's just about modifying some properties.



mark_chen - Friday, July 15, 2011 5:22 AM:

Hi

In Aras 9.3 can support the workflow with Versionable item,

but, the workflow automation examples does not support workflow with versionable item .

when I run the get controlled item always pop up " Error retrieving the controlled item"

Any idea to modify the "get the controlled item" code ?

 

Thanks

==============================

' Get the controlled item
Dim inn As Innovator = Me.newInnovator()
Dim controlledItem As Item = Me.newItem(Me.getAttribute("type"),"Get Controlled Item")
controlledItem.setID(Me.getID())
controlledItem = controlledItem.apply()
If controlledItem.getItemCount() <> 1 Then
 Return inn.newError("Error retrieving the controlled item:" & controlledItem.getErrorDetail())
End If



parepalli - Monday, May 26, 2014 1:28 PM:

In case you found out, how to get controlled item for versionable items. Please let me know. Thanks



ejmoska - Tuesday, May 24, 2016 3:13 AM:

Hello,

I have also ran into this problem , when using the workflow assignment example on versionable document i get error retrieving controlled item.

This error only occurs if the versionable item get's a new generation during the workflow.

The code is below,  help is very much appreciated

' Workflow Assignment Example
' Demonstrates dynamic workflow assignment based on properties of the controlled item

' Get the controlled item
Dim inn As Innovator = Me.newInnovator()
Dim controlledItem As Item = Me.newItem(Me.getAttribute("type"),"Get Controlled Item")
controlledItem.setID(Me.getID())
controlledItem = controlledItem.apply()
If controlledItem.getItemCount() <> 1 Then
 Return inn.newError("Error retrieving the controlled item:" & controlledItem.getErrorDetail())
End If

' Build an array of the reviewers
Dim reviewers As New ArrayList()
Dim i As Integer
For i = 0 To 2
 If controlledItem.getProperty("reviewer"&(i+1),"") <> "" Then reviewers.Add(controlledItem.getProperty("reviewer"&(i+1),""))
Next

' Add an assignment for each reviewer
Dim assignment As Item = Me.newItem("Activity Assignment","")
assignment.setAction("add")
assignment.setPropertyAttribute("locked_by_id","is_null","1")
assignment.setProperty("source_id",Me.getID())
For i = 0 To reviewers.Count - 1
 assignment.setProperty("related_id",reviewers.Item(i))
 assignment.setProperty("voting_weight",100 reviewers.Count + 1)
 Dim res As Item = assignment.apply()
 If res.isError() Then
  Return inn.newError("Workflow Assignment: Error adding assignment: " & res.getErrorDetail())
 End If
Next

' Change the Activity text (just so a change is visible in the InBasket)
Dim activity = Me.newItem(Me.getAttribute("type"),"edit")
activity.setID(Me.getID())
activity.setProperty("message",CStr(reviewers.Count)&" Assignments Added")
activity = activity.apply()
If activity.isError() Then
 Return inn.newError("Error editing activity: " & activity.getErrorDetail())
End If

Thank you!