Solved

Conditionally start a Workflow

  • 22 November 2019
  • 5 replies
  • 45 views

Badge +5

Hi,

  I have a  requirement to start a workflow based on certain condition.  Condition is to start a workflow , if any file is loaded into a folder path. I am using File System Service smart object  to check if the file count is greater than zero using Getfiles Method. But the workFlow is not getting started. Any help is greatly appreciated as there is no enough documentation on how to start a workflow based on smart object value.

 

Thank You

icon

Best answer by katlehon 22 November 2019, 08:49

View original

5 replies

Hi Kathija,


 


Here is where you can configure the start rule and how you can do so ...in your workflow, do the following:


 



  1. When you CLICK to highlight the start event icon, make sure to select the "Conditionally start" radio button on the   third panel. And then click on "Edit start rule".

  2.  Upon clicking the "edit start rule" button, the start rule appears from which you can configure the rules as desired. See image below:

  3. At this point, you will realise that there is an "if else" condition that the start event depends on. Now since you want to start the workflow based on a SmartObject, open the context browser and CLICK to highlight "SmartObjects" as depicted on the image below.

  4. And the you will need to navigate to the SmartObject that you intend to start your workflow based on. And then choose the "Get List" method by "ID" as depicted on below image:

  5. At this point, you have set the start rule to execute if the list of a SmartObject is greater than 0. 


Now, I may not have produced an exact solution to your issue, but this was just to show you where and how you may configure a start rule to start based on a SmartObject count. Hopefully it points you to the right direction. 


 


Please also spend some time on this document about conditional start rule:


https://help.k2.com/onlinehelp/k2five/userguide/5.3/default.htm#K2-Workflow-Designer/Use/Canvas/StartStep/StartRule/Conditional-Start-Rule.htm


 


Regards,


Katleho 


 


 


 


 


 


 


 


 


 


 


 


 


 


 


 

Badge +5

Hi Katlehon,

 

Thank you for the detailed response. I am following the same steps as mentioned  to start the workflow, But workflow is not getting started. Should i set any specific rights?Manually i am able to start the workflow using Start new button  ,but the conditional Start is not Working as expected.

 

 

I don't think it is a "rights" issue if you can start it normally. However, If you start a workflow from a SmartForm and the start condition is not met, depending on how logging is configured, you can possibly find an entry in the server logs stating something like “The process <name> was not started because the conditional start rule evaluated to false” to show that the workflow instance did not start. This applies to solutions built with K2 Five 5.2 or later. To find the server log go to <install drive>:Program FilesK2Host Server.

Check this file, lets see what it says?

Good day Kathija,


 


Perhaps you could make use of a SharePoint reference to conditionally start the workflow?


 


If interested, please see our product documentation on how to do so.


https://help.k2.com/onlinehelp/K2Cloud/UserGuide/Update_10/default.htm#How-Tos/CSRSP/Conditional-Start-Rule-SP.htm


 


Kind regards,


Dumisani 

Badge +5

Hi Katlehon,

 Thank you for the response. Conditionally start is working as per the steps given, But my requirement is to  start the workflow automatically when the condition is satisfied. For ex: My application needs to monitor folder. If any File is  copied into that folder then my workflow should start automatically.  I want to know if i can achieve this in K2 else i need to write windows service to monitor this folder  to trigger the workflow automatically.

 

 

Reply