tag:help-archives.hannonhill.com,2010-02-09:/discussions/web-services/1318-workflow-and-workflow-definition-relationshipCascade CMS: Discussion 2014-03-07T14:08:54Ztag:help-archives.hannonhill.com,2010-02-09:Comment/318221932014-02-27T20:09:05Z2014-02-27T20:09:05ZWorkflow and workflow definition relationship<div><p>Hi Wing,</p>
<p>Let me check with the developers, but I believe
<code>workflowConfiguration.workflowDefinitionId</code> would be
the same value as
<code>readWorkflowInformationResult.workflow.id</code>, have you
tried this by chance to confirm? Also, I would think if the
Workflow is not available for the asset you would get an error.</p>
<p>Please let me know if you have any questions.</p>
<p>Thanks!</p></div>Ryan Griffithtag:help-archives.hannonhill.com,2010-02-09:Comment/318221932014-02-27T20:59:39Z2014-02-28T16:28:29ZWorkflow and workflow definition relationship<div><p>Ryan,</p>
<p>You are both right and wrong regarding workflow definition id.
What is not correct is that the id of a workflow definition is
constant, whereas its different instantiations have different id's
(I tried this twice and I got two different id's, both are
different than the definition id). That is to say,
readWorkflowInformationResult can return different id's at
different times. But strange enough, both the workflow definition
id and the workflow instance id work in the workflowConfiguration.
That means that I don't need the workflow definition id. I can just
work with the workflow instance id. But then the
workflowDefinitionId in the WSDL is not quite accurate. It is
either the workflowDefinitionId or the (undefined)
workflowInstanceId.</p>
<p>Thank you for helping.<br>
Wing</p></div>Wing Ming Chantag:help-archives.hannonhill.com,2010-02-09:Comment/318221932014-02-28T14:47:35Z2014-02-28T14:47:35ZWorkflow and workflow definition relationship<div><p>Thank you for following up, Wing, and my apologies for the
incorrect statement.</p>
<p>After speaking with the developers, here is what I found
out:</p>
<p>When reading workflow information, the returned object will
represent the most recent workflow that was or is being used on the
page. This workflow object is disassociated from the workflow
definition; the only thing that is stored in the database for that
object related to workflow definition is the workflow definition's
XML configuration. So there is really no way to get the workflow
definition's id.</p>
<p>Based on what we are seeing in the code, here is some additional
information that I hope may be helpful:</p>
<p>When editing a page through web services, the web services user
has a choice of what workflow to start, or, if the asset is already
in workflow and the workflow is currently in the edit step, user
can advance the workflow.</p>
<p>When starting a new workflow, it's up to the web services user
to decide which workflow to start - it does not have to be the same
one that was previously used.</p>
<p>When advancing a workflow, the only property that will be used
from the supplied WorkflowConfiguration object during actual edit
is workflowComments. All other properties will be ignored, even if
they are required by WSDL - so for required fields other than
workflowComments any random values will work, since they will be
ignored.</p>
<p>Please let me know if you have any questions or would like any
further clarification.</p>
<p>Thanks!</p></div>Ryan Griffithtag:help-archives.hannonhill.com,2010-02-09:Comment/318221932014-02-28T15:01:12Z2014-02-28T16:28:30ZWorkflow and workflow definition relationship<div><p>Thank you for the additional information. This is precisely what
I need to know. Right now I am building a Workflow class and
reworking my Page class. I just want to add something to your point
concerning editing a page. The user can actually choose no workflow
in the back-end. I am yet to try to use web services to edit a page
with different options, including no workflow.</p>
<p>Since the id is ignored altogether, that explains why it does
not matter even if I just pass in the instance id to advance the
workflow.</p>
<p>Wing</p></div>Wing Ming Chantag:help-archives.hannonhill.com,2010-02-09:Comment/318221932014-02-28T16:09:29Z2014-02-28T16:28:30ZWorkflow and workflow definition relationship<div><p>To follow up, this is how to start a workflow for a page:</p>
<pre>
<code>$id = 'e98efb3e8b7f08560139425c01f43ffb';
$wf_config = new stdClass();
$wf_config->workflowName = "New Test";
// real workflow definition id #1, use this one
//$wf_config->workflowDefinitionId = '65221ba58b7f085600ae22825f36b20e';
// real workflow definition id #2, use this one
$wf_config->workflowDefinitionId = '32fbe4288b7f0856002a5e114b274d2b';
// junk, no workflow
//$wf_config->workflowDefinitionId = 'blah';
$wf_config->workflowComments = 'Starting a new workflow';
$asset->workflowConfiguration = $wf_config;
$asset->page = $page;
$service->edit( $asset );</code>
</pre>
<p>That is to say, a real workflow definition id is required to
start a workflow. Note that this works for any page, even when the
parent folder has no workflow settings.</p>
<p>Wing</p></div>Wing Ming Chantag:help-archives.hannonhill.com,2010-02-09:Comment/318221932014-02-28T16:33:57Z2014-02-28T16:33:57ZWorkflow and workflow definition relationship<div><p>Thank you for following up with your code sample, Wing.</p>
<blockquote>
<p>That is to say, a real workflow definition id is required to
start a workflow. Note that this works for any page, even when the
parent folder has no workflow settings.</p>
</blockquote>
<p>That is correct, when working with workflows through Web
Services, you are not limited to a Workflow that is attached to the
parent folder.</p>
<p>Please let me know if you have any additional questions.</p>
<p>Thanks!</p></div>Ryan Griffith