In SharePoint workflow, when we are using the if/else activities, the if/ else methods contains Event argument called ConditionalEventArgs.
if you set e.Result=true, then if block will executes,
if you set e.Result=false, then else block will executes.
private void IfMethod(object sender, ConditionalEventArgs e)
{
if (isTrue)
e.Result = true;
else
e.Result = false;
}
private void ElseMethod(object sender, ConditionalEventArgs e)
{
if (!isTrue)
e.Result = true;
else
e.Result = false;
}
depending on the boolean variable “isTrue”, the if/else blocks will executes…
In the above case, i am setting “isTrue” variable depending on my logic, before calling if/else statements.
For while activity also, same logic applies.
if you set e.Result=true, it will iterate until you set e.Result=false.
wow.. what was that ? read it one more time.. this is funniest code i have read in long time..
ReplyDeleteI choose a more simple way.
ReplyDeleteprivate void ReviewTaskComplete(object sender, ConditionalEventArgs e) //Review Policy Delay
{
e.Result = !this.ReviewerTaskComplete;
}