ashu_vik - Thursday, September 10, 2009 12:50 AM:
Hi All,
I have a scenario at hand where I want to do the following tasks:
1. In the PR workflow, I have a "Verify PR" activity. The asignee has set a variable called "CostEstimation" in the "Variables" tab of the PR workflow.
2. If the CostEstimation >1000$ then the PR should enter the "Verified" path else the PR should enter the "Unverified" path. Is it possible to do so using client/server events?
Any pointers on where to find the value of the variable(CostEstimation) in the code would also help.
Thanks, Ashu
RobMcAveney - Thursday, September 10, 2009 1:02 AM:
Hi Ashu -
Check out the Workflow Automation Examples project on this site. The Workflow Branching Example is pretty close to what you're looking for. Unfortunately, the project has not yet been updated to work with 9.1 (it's on my to-do list), but there is a description of how it's done and the code should be readable in the xml file. Let me know if you need more help and I'll try to update the project soon.
Rob
ashu_vik - Friday, September 11, 2009 5:55 AM:
Hi Rob,
Thanks for your quick response. I have downloaded the example and implemented it successfully. It actually is pretty close to something I am looking for. The example uses the following code:
------------------------------------------------------------------------------------------------------------------------------------------------------------
' 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
' Fetch the value of the plant A/B/C
Dim plant As String = controlledItem.getProperty("plant","")
' Find the path with the same name as the plant
Dim qry1 = Me.newItem("Workflow Process Path","get")
qry1.setAttribute("select","id")
qry1.setProperty("source_id",Me.getID())
qry1.setProperty("name",plant)
Dim path = qry1.apply()
If path.getItemCount() <> 1 Then
Return inn.newError("Unable to retrieve the '" & plant & "' path")
End If
' Set the path as the default
path.setAction("edit")
path.setProperty("is_default","1")
path = path.apply()
If path.isError() Then
Return inn.newError("Error setting default path: " & path.getErrorDetail())
End If
----------------------------------------------------------------------------------------------------------
But I have following doubts in the code as I am new to programming:
1. What is the controlled item in the code? Is it the form in which the Plant location is specpfied or is it the dropdown field where the plant value is selected?
2. What does "Me" refer to in the code?
3. What does qry1.setAttribute("select","id") do? What is the "id" here?
Thanks
Ashu
ashu_vik - Thursday, September 17, 2009 1:14 AM:
Hi Rob,
I am able to get the required functionality.
Thanks for your help. The example you quoted showed me the way forward.
Regards,
Ashu
