Skip to main content

Hi,

 

I wanted to know if i can extend an existing k2 client event say a mail event. Actually i need to conditionally execute the mail event and skip it otherwise. That condition is to be determined in a server event in the same activity. I cannot move the server and mail event in separate activities and use line logic. So i was thinking of updating a flag as a process/activity level data field in my server event and then using that in my "custom" mail event to skip sending email (or any other client event) based on that flag. I knwo one option is to use k2 project wizard and create new client events all together. I was thinking of just reusing existing ones with a wrapper on top somehow. Please help.

You can "extend" the events to a certain point. If you right click on the event and click the View Code option. You can modify the code there. For your scenerio, If I understand correctly, I think you just want to send an email depending on for example a datafield value. One way to ahieve this would be to create a seperate workflow for the mail event. Put a flag datafield in that workflow for example a boolean datafield such as "IsSend". In the line rule coming from the start and joining tot he mail event activity, use the built in logical operators to do a if statement such as IF (IsSend = true). Now put a IPC event in your parent workflow that calls this mail workflow and you basically pass in all the input parameters of the mail event and the flag IsSend. This method may not be the simplest but it will work even if your mail event is in the middle of other activities. Would have to look at your process to find the easiest and best solution.

 

Hope this helps.

Thanks


Thanks for the reply. I was thinking about the IPC thing. But i m going to have many of these "mail events" and i am not sure if the workflow diagram would be proper in sucha sceanrio with another process there. I tried extending the code and it worked. However i am not sure of how it all works. I saw there are all these event definitions on the server. I modified the default email event and reset my toolbox but nothing happened. I made changes to the event using the client and it worked fine. If you could tell me about what actually happens when you modify the code for a client event on the client and deploy that be great...


HI, When you modify an event it only modifie that instance of that email event. So if you drag another email event that will be the same as before. With the IPC mail events you always just have one mail event but dynamically change the HTML. By passing it as a datafield or using a smartobject to return different HTML depending on what parameteres you pass to that smartobject. 

 

Thanks


Reply