Skip to main content

Dears K2 Team,

 

I need to explain how to pass parameters from user interface to the process when initiating the work flow from code behind. For example, I make sample process for test. This process consist of two steps only, one of them has MailEvent] that responsible for sending email from unknown mail address to another. Whereas both emails will be passed from user interface when initiating the work flow from code behind. How we can do that?

 

Best Regards ;

 

Rami Abdul Salam

 

Hi Rami,

 

In your process create a data field which can accept the input from the form.

In your form have a control that will contain the data that needs to be sent.

Check in your form and then switch to your workflow.

Run the K2 SmartForms Integration Process wizard and then in the wizard there is a screen where you can populate data field values from your form.

During runtim the value in the field will be written to the Process and you can then use the data field in your process.

 

Hope this helps!

Regards,

JohanL


Hi Rami,

 

if your UI does not use the SmartForm you can use the K2 API or services to start a new process.

 

In this example the default WCF service is used to start a process and populate the data fields.

https://help.k2.com/onlinehelp/k2blackpearl/devref/current/webframe.html#start_a_workflow_using_WCF_service.html

 

There are also web services which can be used but there's currently a bug which is supposedly fixed in the next version. If the starting user does not have admin permissions for the process, than the service throws an exception also the process starts just fine.

 

As an alternative you could also use the K2 API:

In this example the Client API is used.

https://help.k2.com/onlinehelp/k2blackpearl/devref/current/webframe.html#Start_Instance_and_Get_Data_Fields.html

This is the equivalent Server API method.

https://help.k2.com/onlinehelp/k2blackpearl/devref/current/webframe.html#workflow.management/topic1345.html

 

Regards,

Daniel


Dears K2 Team,

 

     Thank you so much. This solutions is helped me and solved my problem.

 

best regards ;

 

Rami Abdul Salam


Reply