Conditional Statement example in SharePoint workflow.

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.

0 komentar:

Post a Comment

Related Posts with Thumbnails
GiF Pictures, Images and Photos