Skip to main content

Here is a small challenge that is bothering me for a while now.
I'm trying to make SmartObject that will return XML structure with needed approvers (serial and parallel).
So I need to dynamically create destination sets (serial) and put users inside for parallel approval.



Example xml:
<approval DestinationSetName="Step1">
  <approver>K2DEMOUser1</approver>
  <approver>K2DEMOUser2</approver>
</approval>
<approval DestinationSetName="Step2">
  <approver>K2DEMOUser3</approver>
</approval>


any ideas?

Any Ideas?
I spent 2 days since this post trying to achive this with no succes. I'm not eaven on the path.


Is anybody trying to do anything with Destination code?
Any documentation reference?


tnx


Thanx for reply cyclops,


I had something simular in mind. That is one scenario that can work.
But I would like someone from K2 could give us more info on how to programaticly set Destination sets as that should be the way to do it.


tnx cyclops...


 


While I haven't passed users through XML into destinations sets, I've done similar examples to this using a pure Smartobject design.

In one case, I didn't use multiple destination sets, but instead used a controller activity to increment the "step" and then I passed the activity and step criteria to the Smartobject to give me the correct parallel approvers as the activity was reinstantiated after the increment.

In my example this worked great too, because I was able to add an extra mail event to the controller activity which notified the originator of what "step" the approval was currently on.


 I populated the smart object directly from an aspx page, where the user could fill out a list of users and match up a "step" number for each user.

Additionally consider that the design can be much clearer to the business user if the "serial" group approvals are separated into concise activities.  It really depends on how dynamically this destination data will be maintained (whether updates to it will affect running processes) and/or if there will be an infinite or finite number of steps.


Thank you for reply Joseph


I understand your concern for design, but it is little different.
We have developed complex system that according to input data in any kind of form (ex: InfoPath) and organization hierarchy returns sets of users that need to approve document in real time. Users have friendly interface to delegate and manage rights for approval.
So idea is to start BP process with InfoPath form. When process starts our Smart Object needs to contact our Approval service and according to input data set destination sets and users for activities to follow.
This Smart Object returns XML.
<eApproval
   <Approval  State="" Description="" StartTime="" EndTime="">
       <Approvers >
          <Approver User="DEVUser1" AuthorizedApprovalExecutor="" State="" StartTime="" EndTime="" />
       </Approvers>
   </Approval>
   <Approval  State="" Description="" StartTime="" EndTime="">
      <Approvers>
         <Approver User="DEVUser 2" AuthorizedApprovalExecutor="DEVUser3; DEVUser4"  State="" StartTime="" EndTime="" />
        <Approver User="DEVUser 5" AuthorizedApprovalExecutor=" " State="" StartTime="" EndTime="" />
      </Approvers>
  </Approval>
</eApproval>


To clear this up a little. This is example of serial approval. First User1 must approve, after he approves, User 2 AND User5 must approve. BUT, in User2 case approval can be done by User2, User3 or User 4.


We really need help with this one


From what I understand the current serial/parallel method is going to apply to users individually not entire groups like you need here.   What you are creating is a hybrid of serial and parallel so:


 1)  Shouldn't matter whether you assign the users directly from the smartobject or push it though XML although, I'm not convinced that you really need XML in this case.


2) You would have multiple destination sets each with a line rule that you can control in order to feed the kind of data you want.  ie.   feeding a group?  populate a process.datafield called "groupname' and set the destination rule to look for that "groupname" field to contain something before resolving to true.   ie2  feeding a single user?  populate a process.datafield called "destinationuser.activityX" and again use a destination rule for that destination set that checks this field for a value.     With this destination rule structure, yuou can actually assign an activity to a group and a user in parallel.


3)  Since you will be planning this activity in parallel for multiple approvals at each serial step you will need to handle the serializatiion as i said before using a "controller" activity that behaves much like one-leg of a spider worklfow.  http://k2underground.com/blogs/adriaanandolaf/archive/2007/06/27/workflow-design-spider-workflow.aspx


finally)  SmartObjects don't set destination users,  you have to setup the destination sets and rules to execute when the activity begins and each of those can pull from the Smartobject using criteria that the destination rule and destination set can see: either process data or other smartobject data...


Here is a full article on the subject:


http://k2underground.com/forums/ShowPost.aspx?PostID=18999




I wanted this to work with ASP.NET (not InfoPath) and stumbled into the solution. I've documented how to get it working in this post. http://merill.net/2010/06/dynamically-setting-multiple-activity-destinations-in-k2-with-asp-net/


The trick is to get the correct xml schema. Without it setup properly K2 just picks the first data item and you end up sending the item to just the first person on the list.




Reply