Skip to main content
Hi

I want to make use of the viewflow component(http://kb.k2workflow.com/Articles/KB000023.aspx) in a webpage. This component should be working in a windows or web application, but this component is a windowscontrol, how can this work????. How can I use this component in a webapplication? I don't want to make use of the Workspace/K2MIS/ViewFlow.aspx page but my own custom page.

Can someone give me the solution?

Thanx
Hi,

You can build your own ViewFlow page with very little effort. You will need to add some code in both the aspx and the code behind file of your custom ViewFlow page.

For the aspx file:
Add a javascript function called window_onload to be called when the onload event of the body object is called.
<SCRIPT language="javascript" id="clientEventHandlersJS">
function window_onload()
{
if (document.all('errormessage').value == '')
{
document.getElementById('ViewFlow').Xml = document.getElementById('strXML').value;
document.getElementById('ViewFlow').ScrollBars = true;
return true;
}
else
{
alert(document.getElementById('errormessage').value);
return false;
}
}
</SCRIPT>

And add the call to the onload event of the body tag:
<body MS_POSITIONING="GridLayout" onload="return window_onload()">

Add an Object tag to the page to display the image generated by the ViewFlow component:
<OBJECT id=ViewFlow height="90%" width="90%" border=1 
classid=http:ViewProcessInstance.dll#ViewProcessInstance.ViewControl
VIEWASTEXT>
</OBJECT>

You will also need to add two hidden controls to hold the XML needed for the image generation and any errors that may occur:
<input type="hidden" id="strXML" Runat="server" />
<input type="hidden" id="errormessage" Runat="server" />

For the code behind, you will need to add a reference to K2ROM.dll and populate the "strXML" hidden field with the XML needed to generate the ViewFlow image:
));  

strXML.Value = sXML; // strXML is the hidden control
// declared in the aspx file.
}
finally
{
K2Conn.Close(); // Always close connection to K2 server
}
}
}


Lastly, make sure that a copy of the ViewFlow.dll is in the same folder as your custom ViewFlow page. You can get the original dll from "C:Program FilesK2.net 2003K2WSWorkspaceK2MIS", assuming of course you installed K2 in the default location.
Sir, If I do not start a process yet. Can I show the process flow graph?

Hi pochien,


No, unfortunately the K2Conn.ViewProcessInstance method call takes a Process Instance ID as parameter.  A ProcessInstanceID is only generated for running process instances i.e. you'll need to start a process instance before displaying the Viewflow.


Regards,


Ockert


If you just need to show the flow without process progress, you can just feed the Process XML definition to the viewflow component. So you can store the process XML definition into the database, and when you like to show the flow chart(like in K2 studio), you got the XML document and send to viewflow component.

Hi Michael,

Would you please tell me how to use the XML file , when I want to show the flow chart as K2Studio? 


Hi ,


I create a viewflow page. But some user's computer cannot view the flow chart . We check the computers, they did not install .Net Framework . Does the ViewFlow solution go to run under client user's .Net Framework?


Does it possible can be run under the environment without .net framework?


 Pochien


Yes, unfortunately it does need the .Net Framework on the client machine.


Regards,


Ockert


Hi,


I have this working perfectly from my machine, however when I deploy it to my web server (which also has K2 installed) it does not display the image


You may consider checking out out KB000094 ("No Image displayed after clicking the “View Flow” link from the Workspace");


http://kb.k2workflow.com/articles/kb000094.aspx


 


HTH.


Reply