Skip to main content
Nintex Community Menu Bar

I am attempting to pass the workflow task serial number into the rules in my smartform in order to action a worklist item. I can get the workflow ID which seems to be a 3 digit such as 183. The task serial number is the 3 numbers 183 and an underscore with 2 more numbers. i.e. 183_20. I thought the 20 would stay consistent based on the task but it turns out it changes on me. How do I get that number to pass to my smartform so that when a certain rule happens on the form on submission it actions my worklist items. 

The second part of the serial number will be different for each user getting assigned the task - it is the "ActivityInstanceDestinationID" I believe. I'd pass the entire serial number to your form from the workflow when you create the task, then you don't need to worry about the two parts of the serial number just trust what the workflow is giving you.


I do not see an option to add the ActivityInstanceDestinationID. I guess this is a bit more complication then I originally thought. I have a task that is assigned to multiple people. So each person would have a different ID correct? What I am trying to do is if the right people open the form in sharepoint and fill out the required information I want to automatically complete the task without having to load the task form. I'm attempting to bypass the task form in this instance because I need them to complete specific things on a form and I don't want to be able to submit the form until they have done those items. Is there potentially another way of accomplishing this? 

 

Thanks!


So it sounds like you need your form to go out and find the appropriate serial number for the current user... how does the user open this SharePoint form? Is there any context between this form and the K2 workflow, like do they get to it from a link that the workflow e-mails out or something?


They can get it via an email but what I was hoping to do was just direct them to the sharepoint list. It is possible they would have multiple tasks on multiple forms. I would need to somehow check the user with the current form and open task related to that form/workflow. If I look at the worklist I see the serial number and if I put that in the form it can get it to submit when I am in the form so as long as I can dynamically update the number it seems as though this method would work? 


Yeah, if you can look at the worklist programmatically and find the appropriate task (and serial number) you can definitely use that within your form to action the appropriate task.


I think that is my issue then. I do not know how to progammatically look at the workflow/task in order to pass the information to my form correctly. I can do it in the smartform mapper but that does not put it in the general form.

Thanks


Try using the "Worklist Item" SmartObject that you get out of the box. That may give you a start in the right direction. There are a few other SmartObjects that you get out of the box that may be helpful as well, I recommend you poke around in there to see if any can meet your needs. If not, you may have to make a custom service that uses the workflow client API to get tasks for a given user in the way that you want it but hopefully you can avoid that layer of complexity.


My installation does not include the worklist smartobject that I am aware of. It is a new installation of K2 five on premise. I attempted to download the worklist service broker and install it but to no avail. I also noticed that this service is being put out for pasture in place of the rest service. I am not familiar with the rest service and have been attempting to figure that out. It seems to me that I should be able to easily query a DB and retrieve the current users tasks and filter those based on the current form that way I can use the serialnumber from that item to submit the form and action the worklist task. It would be extremely helpful if the task in the workflow would allow me to write the serialnumber out to something other then the smartform. Anyone know how to do that?

 

Thanks,

Ben


I wonder if that Worklist SmartObject was from a 4.7 install, as all of my environments I play with now have been upgraded to K2 5 and weren't originally installed as K2 5 so I apologize for misleading you there.

 

You can query the K2 database to get a list of tasks, though it is generally not a supported solution. If there aren't any other worklist SmartObjects available then go ahead and try queryig Server.WorklistHeader in your K2 database as a starting point. It can get pretty complicated depending on how your tasks are assigned but that should get you pointed in the right direction.


I was not able to sucessfully install the worklist service and it seems that it is no longer the right way to accomplish finding the worklist anyway. After spending quite some time trying to figure this out, it turns out the service is readily available in the designer by simply click on the show(all) link on the bottom and selecting the System Objects check box. From there you can find the worklist in the Categories > System > Management > Workflows > SmartObjects > Worklist Item. 



One useful tip. Starting from K2 Five, everything you can do in the new Workspace and Management are all SmartForms that are interacting with SmartObjects in the background.


 


If you are interested in adding some action or feature that can be found in Workspace or Management into your form, but do not know which SmartObject to use, you can enable SmartObject logging, perform the action in Workapce or Management, then analyze your SmartObject logs to figure out what SmartObjects are being called, which method is used, and what property values are being inserted.


 


Reply