title: Howto use WF4 rules to run WF4 Activities
body: <p>I am trying to make an invoice processing workflow and I dabbled with the System.Activities.Rules part of WF4 and I kindof like it. However I would like to take the starting point with the rules instead of kicking of an Activity first. </p>
  
  <p>Like this</p>
  
  <p>Incomming collection of invoices = Invoices</p>
  
  <p>For each invoice put it in an envelope wich will contain Workflow metadata like status, nextActivity etc.</p>
  
  <p>Throw the envelope on a set of Rules that if the condition matches sets the next Activity with a set of parameters like this, IF CustomerID = XYZ then setNextActivity(SplitInvoiceActivity(Customer1,Customer2, Percentage))</p>
  
  <p>then the Activity splits the invoice into 2 invoices and puts them back into the loop and when no rules Applies we set the Envelope state to something like "Processed Done" and it exits.</p>
  
  <p>How would I model this with WF4 activities? 
  Wich type of Activity should I derive from, nativeActivity, CodeActivity etc. </p>
  
  <p>Thx in advance!</p>