jamar
8 years agoIdeator III
Checkworkflow comments when voting
Hello,
I have a requirement to check that the comments section of the workflow voting screen is filled in if following a certain path based on a certain person voting. There are multiple assignments for each activity
If I use the code on the event "On Vote" then I can check the path and identity, but comments are not shown (as they have not reached the server yet I assume?).
If I use the code on the event "On Close" then I can check path, identity and comments, but only if it is the last assignment of the activity.
Is anyone able to provide some guidance?
My code:
Dim MyInn As Innovator = Me.getInnovator()
Dim CtrlItem As Item = MyInn.newItem("Activity", "TRL_Get_Controlled_Item")
CtrlItem.setID(Me.getID())
CtrlItem = CtrlItem.apply()
Dim ActivityAsgn As Item = MyInn.newItem("Activity Assignment", "get")
ActivityAsgn .setAttribute("select", "")
ActivityAsgn .setProperty("source_id", Me.getID())
ActivityAsgn = ActivityAsgn .apply()
Dim CurrActAs As Item = Nothing
Dim wfcomments as string = ""
Dim q as string = ""
Dim pathtotake as string = ""
Dim userID As String = MyInn.getUserAliases()
For I As Integer = 0 To (ActivityAsgn .getItemCount() - 1)
CurrActAs = ActivityAsgn .getItemByIndex(I)
wfcomments = CurrActAs.getProperty("comments")
pathtotake = Me.getProperty("Path","")
q = ActivityAsgn .getItemByIndex(I).getRelatedItem().getProperty("id")
If q = userID Then
If pathtotake = "On Hold" Then
If wfcomments = "" Then
Return myInn.newError("Uh-Oh ID's dont match" + "<br/>" + q + "<br/>" + userID)
Return MyInn.newError("Comments are missing from your vote")
Else
Return MyInn.newError("wf comments " + wfcomments)
End If
Else
Return MyInn.newError("Not chosen an affected path")
End If
Else
Continue For
End If
Next I