Scenarios where K2 activity fields can be used


Userlevel 3
Badge +9

Can anybody help me what is the purpose of the K2 activity fields? and in what scenarios K2 Activity fields can be used?

Action Result and Outcome fields are used for decision-making process in workflows but would be use of custom field, if we create?

 

12306i8972ACC51F133217.png


3 replies

Userlevel 1
Badge +8

To best understand how Activity fields can be used, you first need to take a moment an keep in mind the behavior of the activities themselves. Activities have planning options that dictate their behavior. You might have a single instance of an activity or in a Plan Per Slot or Plan Per Destination scenario you would have multiple instances of an activity.

 

An activity datafield is scoped to just the activity whereas a process datafield is global to the process. You have noticed the action result field, which contains that action taken for each specific instance of an activity. 

 

For the programming folks, an activity field is a local variable.

 

A use case for an activity field is when you need to save a bit of data that is needed for processing just in the activity and isn't needed anywhere else in the process. Activity datafields are visible to line rules. So you could make some sort of smart object call, save a count of the results of the call to an activity field and then evaluate the field in the line rule to decide if you need to follow that path.

 

In an update I made to a plug in for smart actions that grabs the comments from the message, I create an activity data field to store the comments in the email when a user actions the task. The comments are scoped to the instance of the activity so I am able to process just that users comments in their instance of the activity. If I had been using a process datafield the comments would have stepped on each other before I had a chance to process them.

 

It would be great if others can chime in with their use cases of activity fields. There are many and it really just depends on what you are trying to accomplish. I have used them in scenarios where I was writing information that was occurring in other activity instances concurrently to then take some sort of follow up action. In that use case, I was saving the destination users and building a dynamic distribution list so when one of the users completed their task I could notify the remaining designation users for the activity.

 

I recommend taking K2 out of the equation for a moment and familaring yourself with the use cases for Global or Local variables. Here is wiki post to get you going: https://en.wikibooks.org/wiki/A-level_Computing_2009/AQA/Problem_Solving,_Programming,_Data_Representation_and_Practical_Exercise/Fundamentals_of_Programming/Global_and_Local_Variables

 

This will set you up to then revisit your question adding the additional functionality and nuances that K2 introduces.

 

Hopefully this spurs some conversation and helps you a bit with your question.

 

S.

Badge +3
Hi, Scott. Perfect answer!
Could you share your plug for smartaction with community? Its reality interesting.

"I made to a plug in for smart actions that grabs the comments from the message, I create an activity data field to store the comments in the email when a user actions the task."
Userlevel 3
Badge +9

Hi Scott,

 

Both the scenario sounds interesting.

 

If possible, can you please share the plugin you have created. Just wanted to check how you have coded that.

 

For the second scenario, you created the dynamic distribution list and notified other destination users for that activity. Could you please give some more details on this how you achieved? 

Reply