How to set Process Variable when I start a workflow??
hi,Experts.
I have a question which cost me 2 days but still exist.
I have defined a workflow which include 3 Process variable. When I want to start it through DFC API, I didn't how to put a string, int ,bool etc., into the process variable.
The DFC Version i use is DFC 6.0 SP1.
Any one have an idea. help, please .....
Best Answer
-
I've recently run into this issue myself. The trick is that Process Variables cannot be changed once the workflow is running (in fact, in the DfWorkflowEx class, there's a method that's supposed to throw an exception if you attempt to set variables on a workflow that's not dormant. Unfortunately, that method isn't called so you think everything's set when in fact, they're not). To ensure that your variables are set correctly, first init the workflow (this assumes you want to set the variables at the start of the workflow, not in the middle):
IDfId NewWorkflowId = workflowBuilder.initWorkflow();
then ,set the Process Variables (assumes you get a handle to the workflow first):
<span class="jive-thread-reply-body-container">wfe.setPrimitiveObjectValue("Name", "Freddy")
then, run the workflow:
IDfId NewWorkflowId2 = workflowBuilder.runWorkflow();
That should be it!
- Terence
0
Answers
-
Process variables can be used with Process Builder, not with Workflow Editor which functionality is part of DFC. So what you are searching for (BPM JavaDocs) is located in your Content Server machine: $DOCUMENTUM_SHARED/help/bpm.
There is DfWorkflowEx which contains the methods to add primitive values (and structured data types) to your workflow instance.
Cheers,
Mike
0 -
Hi, i try to set primitive values but system dont take the changes. Any Help? , I put my code here.
DfId idw = new DfId("4d01e24080000686"); // Any running workflow.
IDfWorkflow wf = (IDfWorkflow) session.getObject(idw);
IDfWorkflowEx wfe = (IDfWorkflowEx) wf;
wfe.getPrimitiveVariableValue("Name"); // Returns -> Blank String (Default Value)
wfe.setPrimitiveObjectValue("Name", "Freddy") //It looks like fine
wfe.getPrimitiveVariableValue("Name"); //Returns -> DiegoThem when i go to WebTop the Process Variables don´t take change.
0 -
I've recently run into this issue myself. The trick is that Process Variables cannot be changed once the workflow is running (in fact, in the DfWorkflowEx class, there's a method that's supposed to throw an exception if you attempt to set variables on a workflow that's not dormant. Unfortunately, that method isn't called so you think everything's set when in fact, they're not). To ensure that your variables are set correctly, first init the workflow (this assumes you want to set the variables at the start of the workflow, not in the middle):
IDfId NewWorkflowId = workflowBuilder.initWorkflow();
then ,set the Process Variables (assumes you get a handle to the workflow first):
<span class="jive-thread-reply-body-container">wfe.setPrimitiveObjectValue("Name", "Freddy")
then, run the workflow:
IDfId NewWorkflowId2 = workflowBuilder.runWorkflow();
That should be it!
- Terence
0 -
My final code, as example, it will be helpful:
IDfWorkflowBuilder workflowBuilder = session.newWorkflowBuilder(id);
IDfId initWf = workflowBuilder.initWorkflow();
IDfWorkflowEx setVariables = (IDfWorkflowEx) session.getObject(initWf);
setVariables.setPrimitiveObjectValue("VARNAME1",value1);
setVariables.setPrimitiveObjectValue("VARNAME2",value2);
setVariables.setPrimitiveObjectValue("VARNAME3",value3);
IDfId idWf = workflowBuilder.runWorkflow();
return idWf;
Thank's, for all support !!
0
Categories
- All Categories
- 111 Developer Announcements
- 49 Articles
- 102 General Questions
- 123 IM Services
- 40 OpenText Hackathon
- 31 Developer Tools
- 20.6K Analytics
- 4.1K AppWorks
- 8.9K Extended ECM
- 898 Cloud Fax and Notifications
- 77 Digital Asset Management
- 9.3K Documentum
- 29 eDOCS
- 124 Exstream
- 39.8K TeamSite
- 1.7K Web Experience Management
- 1 XM Fax