Skip to main content

I want to start a workflow, automatically when ain insert is created in a smartobject.

 

I want to do automatically, because, first, i want to import the info from an Excel File, (i can do it), but after that, for each row, i want to start a workflow automatically

 

Thank you

 

Juan Antonio

Hi Juan,

 

one -perhaps not so often used- option, is the event interface. In the K2 workspace, you can configure custom events. Relevant for your requirement is, that you can subscribe to a SmartObject method call. For instance an "Insert" method call.

You have to provide a .NET dll with a static method the event can then call. Within this method, you can launch your process.

 

Cheers,

Harald

 


Hi Juan

 

When you deploy a workflow there is an option to create a smartobject for that workflow. This smartobject will expose a "Start Process" method that will allow you to start the workflow.

 

What you can then do is modify your Create method for the other workflow and add the Start Process service method.


Steps:

  1. On your workflow right click on the blank canvas and select Properties
  2. Select the Association Details tab and click the "Create Workflow SmartObjects" check box
  3. Deploy your workflow
  4. Open the Smartobject you want to start the workflow with in K2 Designer or K2 Studio
  5. Select the Create method and click Edit
  6. Click the ServiceObject method bindings tab and click Add
  7. In the ServiceObject method explorer find the Workflow Service node and expand it to find your workflow
  8. Expand the Process and select the "Start Process" method and click OK
  9. Map any SmartObject properties to the workflow start properties (e.g. Folio) and Finish

When you use the create method now for this SmartObject, the workflow will also start.


Reply