I'm write in C#. I'd like to be able to use DFC to automate most of the mundane tasks of starting a workflow; setting the document, Author name, Approver name, document type, etc...most of the blogs and examples only give bits and peices. And, some of the examples don't seem to work as posted. i.e. passing a string vs. an Object Id.
I have no problem connecting to my docbase and starting a session. I can also get an IDfProcess using my workflow template, generate a Workflow Builder instance from that process Id, and generate an IDfWorkflow instance from the Workflow Builder. But, here is where I get stuck and can't seem to get the order of things nor find out where and how to set the other fields I need.
I am able to set the workflow object name and supervisor name. I also see there is a 'setInstructions' method associated with IDfWorkflow, but can't seem to figure out what goes where, when to assign it, the correct time to call the workflow Init, the correct time to call the workflow Run, etc... I've also seen quite a few blogs discussing Alias Sets. But again, can't seem to get anything working using the example as guidance.
Every time I try to generate an instance of an IDfAliasSet I get an error:
; ERRORCODE: 100; NEXT: null:DfException:: THREAD: main; MSG: [DM_API_E_BADID]error: "Bad ID given: "
If I look in my workflows, I see this new workflow exists and it is running. And the name and supervisor are set correctly.
Here is the code for one of the examples:
.......
//Create DFC client
string DOCBASE = "mydocbase";
clientX = new DFCLib.DfClientX();
client = clientX.getLocalClient();
IDfLoginInfo loginInfo = clientX.getLoginInfo();
//etc....login to doc base
.......
//Open session
session = client.newSession(DOCBASE, loginInfo);
//DFC variable
IDfWorkflowBuilder workflowBuilder;
IDfWorkflow workflow;
IDfId AliasSetId = null;
IDfAliasSet AliasSet = null;
IDfProcess template = null;
//initializing workflow's instance
template = (IDfProcess)session.getObjectByQualification("dm_process where object_name like '"my workflow template name"'");
//create workflow builder
workflowBuilder = session.newWorkflowBuilder(template.getObjectId());
//create workflow
workflow = workflowBuilder.getWorkflow();
workflow.setObjectName("some name for process");
workflow.setSupervisorName("my name");
IDfId wfId1 = workflowBuilder.initWorkflow();
workflow.execute();
IDfId AliasSetId workflow.getAliasSetId();
//AliasSetId always = 00000000000
//so, this will obviously throw BAD ID error
IDfAliasSet l_AliasSet = (IDfAliasSet)session.getObject(AliasSetId);