Skip to main content

I'd like to be able to use a different datasource i.e. SQL to hold the users. Then, depending on certain datafield values, I'll send the process instance to a or many users that are queried for based on the criteria.


 I'm having a tough time getting to the destination user part of K2ROM, if it even exists.


 Does anyone have any thoughts on setting up dynamic destenation users using .NET server code.


Thanks,


Z

you can use SQL out of the box without having to write code by using the SQLUM. If you want to get at roles you can use


SourceCode.Workflow.Management Namespace


but to just add destination users you can add them like this


// Add some destination users


            SimpleDestinationRule destinationRule = new SimpleDestinationRule();


            DestinationSet defaultDestinationSet = new DestinationSet();


            Destination destination1 = new Destination();


            destination1.Type = DestinationTypes.User;


            destination1.Value = K2FieldFactory.CreateK2Field("K2:DomainUser1");


            Destination destination2 = new Destination();


            destination2.Type = DestinationTypes.User;


            destination2.Value = K2FieldFactory.CreateK2Field("K2:DomainUser2");


 


            defaultDestinationSet.Destinations.Add(destination1);


            defaultDestinationSet.Destinations.Add(destination2);


 


            destinationRule.DestinationSets.Add(defaultDestinationSet);


 


            // Set the destination rule of the activity


            awaitApprovalActivity.DestinationRule = destinationRule;


Could you help me understand your question better?  Do you want to store users who are not in AD in a database, or do you want to dynamically select users for a destination based on some criteria. 


Also, please confirm that you are using K2 blackpearl. 


K2ROM is actually the K2.net 2003 runtime API.  K2 blackpearl has more options around how to handle Activity Destinations than K2 2003 so it is important to understand what version you are using.


Where would I find the K2FieldFactory?


And I'm a little confused with the activity since the KO activity doesn't have the desination rule property.


 Am I suppose to enter this code in a server code event or in something else?


 As you can tell I'm new to this object model.


Thanks,


Z


well the simple part was actually taken from the Developer reference. but to get at destrules you would use


 



sourcecode.workflow.authoring



 Zeppelin, were you able to make it work ? Appreciate if you could share the solution.

 

Thanks in Advance 


thx ~~~~

Reply