Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can I create WF rules in code?
    text
    copied!<p>I'm creating an <strong>ActivityToolboxItem</strong> for a custom Activity in WF. I'm trying to do as much work as possible for the designers within the CreateComponentsCore method. What I'm trying to end up with is the following:</p> <p>1) My custom activity (<strong>TriggerActivity</strong>, a <em>SequenceActivity</em>), containing the following:<br> 2) A <strong>TriggerEvaluatorActivity</strong> (a simple <em>Activity</em>), which is bound to a property on the TriggerActivity<br> 3) An <strong>IfElseActivity</strong>, which has two branches<br> 4) An <strong>IfElseBranchActivity</strong> that contains<br> 5) A <strong>TerminateActivity</strong>, and<br> 6) An <strong>IfElseBranchActivity</strong> that is empty, through which execution flows when the TriggerEvaluatorActivity evaluates to true.</p> <p>Designers switch out the <strong>TriggerEvaluatorActivity</strong> with one or more implementations that perform complex evaluations against an execution context. </p> <p>Its pretty simple to set this up in code, but I'm completely stuck on how to spin up an <strong>ActivityCondition</strong> that will be added to the <em>IfElseBranchActivity</em> to control the flow of execution.</p> <p>All I need to do is evaluate a property on the <strong>TriggerEvaluatorActivity</strong>. I've created a nice lovely Rule via the code dom, but I can't set that directly on the <em>IfElseBranchActivity</em>, I have to stash the rule somewhere and reference it in the activity.</p> <p>So, I guess my question is, once I've created a rule in code, how do I add my rule to the workflow from within a custom ActivityToolboxItem so that the activities I build in code can reference it?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload