Skip to main content
Nintex Community Menu Bar

Dynamic Destination Users from datasource

  • May 2, 2008
  • 7 replies
  • 13 views

Forum|alt.badge.img+3

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

7 replies

Forum|alt.badge.img+10
  • Nintex Partner
  • May 2, 2008

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;


Forum|alt.badge.img+11
  • May 4, 2008

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. 


Forum|alt.badge.img+9
  • Nintex Partner
  • May 4, 2008

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.


Forum|alt.badge.img+3
  • Author
  • May 5, 2008

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


Forum|alt.badge.img+10
  • Nintex Partner
  • May 5, 2008

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


 



sourcecode.workflow.authoring


Forum|alt.badge.img+8


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

 

Thanks in Advance 


Forum|alt.badge.img+2
  • April 24, 2009
thx ~~~~