<Activity x:Class="XrmWorkflowd5587dc707484ea5baf004af796e36fb" xmlns="http://schemas.microsoft.com/netfx/2009/xaml/activities" xmlns:mva="clr-namespace:Microsoft.VisualBasic.Activities;assembly=System.Activities, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" xmlns:mxs="clr-namespace:Microsoft.Xrm.Sdk;assembly=Microsoft.Xrm.Sdk, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" xmlns:mxsq="clr-namespace:Microsoft.Xrm.Sdk.Query;assembly=Microsoft.Xrm.Sdk, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" xmlns:mxswa="clr-namespace:Microsoft.Xrm.Sdk.Workflow.Activities;assembly=Microsoft.Xrm.Sdk.Workflow, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" xmlns:s="clr-namespace:System;assembly=mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" xmlns:scg="clr-namespace:System.Collections.Generic;assembly=mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" xmlns:sco="clr-namespace:System.Collections.ObjectModel;assembly=mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" xmlns:srs="clr-namespace:System.Runtime.Serialization;assembly=System.Runtime.Serialization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" xmlns:this="clr-namespace:" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  <x:Members>
    <x:Property Name="InputEntities" Type="InArgument(scg:IDictionary(x:String, mxs:Entity))" />
    <x:Property Name="CreatedEntities" Type="InArgument(scg:IDictionary(x:String, mxs:Entity))" />
  </x:Members>
  <this:XrmWorkflowd5587dc707484ea5baf004af796e36fb.InputEntities>
    <InArgument x:TypeArguments="scg:IDictionary(x:String, mxs:Entity)" />
  </this:XrmWorkflowd5587dc707484ea5baf004af796e36fb.InputEntities>
  <this:XrmWorkflowd5587dc707484ea5baf004af796e36fb.CreatedEntities>
    <InArgument x:TypeArguments="scg:IDictionary(x:String, mxs:Entity)" />
  </this:XrmWorkflowd5587dc707484ea5baf004af796e36fb.CreatedEntities>
  <mva:VisualBasic.Settings>Assembly references and imported namespaces for internal implementation</mva:VisualBasic.Settings>
  <mxswa:Workflow>
    <mxswa:ActivityReference AssemblyQualifiedName="Microsoft.Crm.Workflow.Activities.ConditionSequence, Microsoft.Crm.Workflow, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" DisplayName="WaitStep2: Wait until the next run date">
      <mxswa:ActivityReference.Arguments>
        <InArgument x:TypeArguments="x:Boolean" x:Key="Wait">True</InArgument>
      </mxswa:ActivityReference.Arguments>
      <mxswa:ActivityReference.Properties>
        <sco:Collection x:TypeArguments="Variable" x:Key="Variables">
          <Variable x:TypeArguments="x:Boolean" Default="False" Name="WaitTimeoutStep4_condition" />
          <Variable x:TypeArguments="x:Object" Default="[System.DateTime.MinValue]" Name="WaitTimeoutStep4_1" />
          <Variable x:TypeArguments="x:Object" Name="WaitTimeoutStep4_2" />
        </sco:Collection>
        <sco:Collection x:TypeArguments="Activity" x:Key="Activities">
          <mxswa:ActivityReference AssemblyQualifiedName="Microsoft.Crm.Workflow.Activities.EvaluateExpression, Microsoft.Crm.Workflow, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" DisplayName="EvaluateExpression">
            <mxswa:ActivityReference.Arguments>
              <InArgument x:TypeArguments="x:String" x:Key="ExpressionOperator">RetrieveLastExecutionTime</InArgument>
              <InArgument x:TypeArguments="s:Object[]" x:Key="Parameters">[New Object() { WaitTimeoutStep4_1 }]</InArgument>
              <x:Null x:Key="TargetType" />
              <OutArgument x:TypeArguments="x:Object" x:Key="Result">[WaitTimeoutStep4_1]</OutArgument>
            </mxswa:ActivityReference.Arguments>
          </mxswa:ActivityReference>
          <mxswa:GetEntityProperty Attribute="north52_nextrundatetime" Entity="[InputEntities(&quot;primaryEntity&quot;)]" EntityName="north52_schedule" Value="[WaitTimeoutStep4_2]">
            <mxswa:GetEntityProperty.TargetType>
              <InArgument x:TypeArguments="s:Type">
                <mxswa:ReferenceLiteral x:TypeArguments="s:Type" Value="s:DateTime" />
              </InArgument>
            </mxswa:GetEntityProperty.TargetType>
          </mxswa:GetEntityProperty>
          <Assign x:TypeArguments="x:Object" To="[WaitTimeoutStep4_2]" Value="[Microsoft.VisualBasic.IIf(Microsoft.VisualBasic.IsNothing(WaitTimeoutStep4_2), DateTime.MaxValue, WaitTimeoutStep4_2)]" />
          <Assign x:TypeArguments="x:Boolean" To="[WaitTimeoutStep4_condition]" Value="[DateTime.UtcNow &gt;= DirectCast(WaitTimeoutStep4_2, System.DateTime).ToUniversalTime()]" />
          <mxswa:ActivityReference AssemblyQualifiedName="Microsoft.Crm.Workflow.Activities.ConditionBranch, Microsoft.Crm.Workflow, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" DisplayName="WaitTimeoutStep4">
            <mxswa:ActivityReference.Arguments>
              <InArgument x:TypeArguments="x:Boolean" x:Key="Condition">[WaitTimeoutStep4_condition]</InArgument>
            </mxswa:ActivityReference.Arguments>
            <mxswa:ActivityReference.Properties>
              <mxswa:ActivityReference x:Key="Then" AssemblyQualifiedName="Microsoft.Crm.Workflow.Activities.Composite, Microsoft.Crm.Workflow, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" DisplayName="WaitTimeoutStep4">
                <mxswa:ActivityReference.Properties>
                  <sco:Collection x:TypeArguments="Variable" x:Key="Variables" />
                  <sco:Collection x:TypeArguments="Activity" x:Key="Activities">
                    <mxswa:ActivityReference AssemblyQualifiedName="Microsoft.Crm.Workflow.Activities.ConditionSequence, Microsoft.Crm.Workflow, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" DisplayName="ConditionStep14: Check should the schedule be stopped">
                      <mxswa:ActivityReference.Arguments>
                        <InArgument x:TypeArguments="x:Boolean" x:Key="Wait">False</InArgument>
                      </mxswa:ActivityReference.Arguments>
                      <mxswa:ActivityReference.Properties>
                        <sco:Collection x:TypeArguments="Variable" x:Key="Variables">
                          <Variable x:TypeArguments="x:Boolean" Default="False" Name="ConditionBranchStep15_condition" />
                          <Variable x:TypeArguments="x:Object" Name="ConditionBranchStep15_1" />
                          <Variable x:TypeArguments="x:Object" Name="ConditionBranchStep15_2" />
                        </sco:Collection>
                        <sco:Collection x:TypeArguments="Activity" x:Key="Activities">
                          <mxswa:GetEntityProperty Attribute="north52_stopschedule" Entity="[InputEntities(&quot;primaryEntity&quot;)]" EntityName="north52_schedule" Value="[ConditionBranchStep15_1]">
                            <mxswa:GetEntityProperty.TargetType>
                              <InArgument x:TypeArguments="s:Type">
                                <mxswa:ReferenceLiteral x:TypeArguments="s:Type">
                                  <x:Null />
                                </mxswa:ReferenceLiteral>
                              </InArgument>
                            </mxswa:GetEntityProperty.TargetType>
                          </mxswa:GetEntityProperty>
                          <mxswa:ActivityReference AssemblyQualifiedName="Microsoft.Crm.Workflow.Activities.EvaluateExpression, Microsoft.Crm.Workflow, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" DisplayName="EvaluateExpression">
                            <mxswa:ActivityReference.Arguments>
                              <InArgument x:TypeArguments="x:String" x:Key="ExpressionOperator">CreateCrmType</InArgument>
                              <InArgument x:TypeArguments="s:Object[]" x:Key="Parameters">[New Object() { Microsoft.Xrm.Sdk.Workflow.WorkflowPropertyType.Boolean, "1" }]</InArgument>
                              <InArgument x:TypeArguments="s:Type" x:Key="TargetType">
                                <mxswa:ReferenceLiteral x:TypeArguments="s:Type" Value="x:Boolean" />
                              </InArgument>
                              <OutArgument x:TypeArguments="x:Object" x:Key="Result">[ConditionBranchStep15_2]</OutArgument>
                            </mxswa:ActivityReference.Arguments>
                          </mxswa:ActivityReference>
                          <mxswa:ActivityReference AssemblyQualifiedName="Microsoft.Crm.Workflow.Activities.EvaluateCondition, Microsoft.Crm.Workflow, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" DisplayName="EvaluateCondition">
                            <mxswa:ActivityReference.Arguments>
                              <InArgument x:TypeArguments="mxsq:ConditionOperator" x:Key="ConditionOperator">Equal</InArgument>
                              <InArgument x:TypeArguments="s:Object[]" x:Key="Parameters">[New Object() { ConditionBranchStep15_2 }]</InArgument>
                              <InArgument x:TypeArguments="x:Object" x:Key="Operand">[ConditionBranchStep15_1]</InArgument>
                              <OutArgument x:TypeArguments="x:Boolean" x:Key="Result">[ConditionBranchStep15_condition]</OutArgument>
                            </mxswa:ActivityReference.Arguments>
                          </mxswa:ActivityReference>
                          <mxswa:ActivityReference AssemblyQualifiedName="Microsoft.Crm.Workflow.Activities.ConditionBranch, Microsoft.Crm.Workflow, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" DisplayName="ConditionBranchStep15">
                            <mxswa:ActivityReference.Arguments>
                              <InArgument x:TypeArguments="x:Boolean" x:Key="Condition">[ConditionBranchStep15_condition]</InArgument>
                            </mxswa:ActivityReference.Arguments>
                            <mxswa:ActivityReference.Properties>
                              <mxswa:ActivityReference x:Key="Then" AssemblyQualifiedName="Microsoft.Crm.Workflow.Activities.Composite, Microsoft.Crm.Workflow, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" DisplayName="ConditionBranchStep15">
                                <mxswa:ActivityReference.Properties>
                                  <sco:Collection x:TypeArguments="Variable" x:Key="Variables" />
                                  <sco:Collection x:TypeArguments="Activity" x:Key="Activities">
                                    <Sequence DisplayName="StopWorkflowStep16: Check should the schedule be stopped">
                                      <Sequence.Variables>
                                        <Variable x:TypeArguments="x:Object" Name="StopWorkflowStep16_1" />
                                        <Variable x:TypeArguments="x:String" Default="0790381e-3c73-40b3-8a21-71b474844142" Name="stepLabelLabelId" />
                                        <Variable x:TypeArguments="x:String" Name="stepLabelDescription">
                                          <Variable.Default>
                                            <Literal x:TypeArguments="x:String" Value="" />
                                          </Variable.Default>
                                        </Variable>
                                        <Variable x:TypeArguments="x:Int32" Default="1033" Name="stepLabelLanguageCode" />
                                      </Sequence.Variables>
                                      <mxswa:ActivityReference AssemblyQualifiedName="Microsoft.Crm.Workflow.Activities.EvaluateExpression, Microsoft.Crm.Workflow, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" DisplayName="EvaluateExpression">
                                        <mxswa:ActivityReference.Arguments>
                                          <InArgument x:TypeArguments="x:String" x:Key="ExpressionOperator">CreateCrmType</InArgument>
                                          <InArgument x:TypeArguments="s:Object[]" x:Key="Parameters">[New Object() { Microsoft.Xrm.Sdk.Workflow.WorkflowPropertyType.String, "", "String" }]</InArgument>
                                          <InArgument x:TypeArguments="s:Type" x:Key="TargetType">
                                            <mxswa:ReferenceLiteral x:TypeArguments="s:Type" Value="x:String" />
                                          </InArgument>
                                          <OutArgument x:TypeArguments="x:Object" x:Key="Result">[StopWorkflowStep16_1]</OutArgument>
                                        </mxswa:ActivityReference.Arguments>
                                      </mxswa:ActivityReference>
                                      <TerminateWorkflow DisplayName="StopWorkflowStep16: Check should the schedule be stopped" Exception="[New Microsoft.Xrm.Sdk.InvalidPluginExecutionException(Microsoft.Xrm.Sdk.OperationStatus.Succeeded)]" Reason="[DirectCast(StopWorkflowStep16_1, System.String)]" />
                                    </Sequence>
                                  </sco:Collection>
                                </mxswa:ActivityReference.Properties>
                              </mxswa:ActivityReference>
                              <x:Null x:Key="Else" />
                            </mxswa:ActivityReference.Properties>
                          </mxswa:ActivityReference>
                        </sco:Collection>
                      </mxswa:ActivityReference.Properties>
                    </mxswa:ActivityReference>
                    <Sequence DisplayName="UpdateStep9: Perform the actual work as defined by the schedule">
                      <Sequence.Variables>
                        <Variable x:TypeArguments="x:Object" Name="UpdateStep9_1" />
                        <Variable x:TypeArguments="x:Object" Name="UpdateStep9_2" />
                        <Variable x:TypeArguments="x:Object" Name="UpdateStep9_3" />
                        <Variable x:TypeArguments="x:Object" Name="UpdateStep9_4" />
                        <Variable x:TypeArguments="x:Object" Name="UpdateStep9_5" />
                        <Variable x:TypeArguments="x:Object" Name="UpdateStep9_6" />
                        <Variable x:TypeArguments="x:Object" Name="UpdateStep9_7" />
                        <Variable x:TypeArguments="x:Object" Name="UpdateStep9_8" />
                        <Variable x:TypeArguments="x:Object" Name="UpdateStep9_9" />
                        <Variable x:TypeArguments="x:Object" Name="UpdateStep9_10" />
                        <Variable x:TypeArguments="x:Object" Name="UpdateStep9_11" />
                        <Variable x:TypeArguments="x:Object" Name="UpdateStep9_12" />
                      </Sequence.Variables>
                      <Assign x:TypeArguments="mxs:Entity" To="[CreatedEntities(&quot;primaryEntity#Temp&quot;)]" Value="[New Entity(&quot;north52_schedule&quot;)]" />
                      <Assign x:TypeArguments="s:Guid" To="[CreatedEntities(&quot;primaryEntity#Temp&quot;).Id]" Value="[InputEntities(&quot;primaryEntity&quot;).Id]" />
                      <mxswa:ActivityReference AssemblyQualifiedName="Microsoft.Crm.Workflow.Activities.EvaluateExpression, Microsoft.Crm.Workflow, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" DisplayName="EvaluateExpression">
                        <mxswa:ActivityReference.Arguments>
                          <InArgument x:TypeArguments="x:String" x:Key="ExpressionOperator">RetrieveCurrentTime</InArgument>
                          <InArgument x:TypeArguments="s:Object[]" x:Key="Parameters" xml:space="preserve">[New Object() {  }]</InArgument>
                          <InArgument x:TypeArguments="s:Type" x:Key="TargetType">
                            <mxswa:ReferenceLiteral x:TypeArguments="s:Type" Value="s:DateTime" />
                          </InArgument>
                          <OutArgument x:TypeArguments="x:Object" x:Key="Result">[UpdateStep9_2]</OutArgument>
                        </mxswa:ActivityReference.Arguments>
                      </mxswa:ActivityReference>
                      <mxswa:ActivityReference AssemblyQualifiedName="Microsoft.Crm.Workflow.Activities.EvaluateExpression, Microsoft.Crm.Workflow, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" DisplayName="EvaluateExpression">
                        <mxswa:ActivityReference.Arguments>
                          <InArgument x:TypeArguments="x:String" x:Key="ExpressionOperator">SelectFirstNonNull</InArgument>
                          <InArgument x:TypeArguments="s:Object[]" x:Key="Parameters">[New Object() { UpdateStep9_2 }]</InArgument>
                          <InArgument x:TypeArguments="s:Type" x:Key="TargetType">
                            <mxswa:ReferenceLiteral x:TypeArguments="s:Type" Value="s:DateTime" />
                          </InArgument>
                          <OutArgument x:TypeArguments="x:Object" x:Key="Result">[UpdateStep9_1]</OutArgument>
                        </mxswa:ActivityReference.Arguments>
                      </mxswa:ActivityReference>
                      <mxswa:SetEntityProperty Attribute="north52_lastrundatetime" Entity="[CreatedEntities(&quot;primaryEntity#Temp&quot;)]" EntityName="north52_schedule" Value="[UpdateStep9_1]">
                        <mxswa:SetEntityProperty.TargetType>
                          <InArgument x:TypeArguments="s:Type">
                            <mxswa:ReferenceLiteral x:TypeArguments="s:Type" Value="s:DateTime" />
                          </InArgument>
                        </mxswa:SetEntityProperty.TargetType>
                      </mxswa:SetEntityProperty>
                      <mxswa:GetEntityProperty Attribute="north52_currentexecutioncount" Entity="[InputEntities(&quot;primaryEntity&quot;)]" EntityName="north52_schedule" Value="[UpdateStep9_5]">
                        <mxswa:GetEntityProperty.TargetType>
                          <InArgument x:TypeArguments="s:Type">
                            <mxswa:ReferenceLiteral x:TypeArguments="s:Type" Value="x:Int32" />
                          </InArgument>
                        </mxswa:GetEntityProperty.TargetType>
                      </mxswa:GetEntityProperty>
                      <mxswa:ActivityReference AssemblyQualifiedName="Microsoft.Crm.Workflow.Activities.EvaluateExpression, Microsoft.Crm.Workflow, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" DisplayName="EvaluateExpression">
                        <mxswa:ActivityReference.Arguments>
                          <InArgument x:TypeArguments="x:String" x:Key="ExpressionOperator">SelectFirstNonNull</InArgument>
                          <InArgument x:TypeArguments="s:Object[]" x:Key="Parameters">[New Object() { UpdateStep9_5 }]</InArgument>
                          <InArgument x:TypeArguments="s:Type" x:Key="TargetType">
                            <mxswa:ReferenceLiteral x:TypeArguments="s:Type" Value="x:Int32" />
                          </InArgument>
                          <OutArgument x:TypeArguments="x:Object" x:Key="Result">[UpdateStep9_4]</OutArgument>
                        </mxswa:ActivityReference.Arguments>
                      </mxswa:ActivityReference>
                      <mxswa:ActivityReference AssemblyQualifiedName="Microsoft.Crm.Workflow.Activities.EvaluateExpression, Microsoft.Crm.Workflow, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" DisplayName="EvaluateExpression">
                        <mxswa:ActivityReference.Arguments>
                          <InArgument x:TypeArguments="x:String" x:Key="ExpressionOperator">CreateCrmType</InArgument>
                          <InArgument x:TypeArguments="s:Object[]" x:Key="Parameters">[New Object() { Microsoft.Xrm.Sdk.Workflow.WorkflowPropertyType.Integer, "1" }]</InArgument>
                          <InArgument x:TypeArguments="s:Type" x:Key="TargetType">
                            <mxswa:ReferenceLiteral x:TypeArguments="s:Type" Value="x:Int32" />
                          </InArgument>
                          <OutArgument x:TypeArguments="x:Object" x:Key="Result">[UpdateStep9_7]</OutArgument>
                        </mxswa:ActivityReference.Arguments>
                      </mxswa:ActivityReference>
                      <mxswa:ActivityReference AssemblyQualifiedName="Microsoft.Crm.Workflow.Activities.EvaluateExpression, Microsoft.Crm.Workflow, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" DisplayName="EvaluateExpression">
                        <mxswa:ActivityReference.Arguments>
                          <InArgument x:TypeArguments="x:String" x:Key="ExpressionOperator">SelectFirstNonNull</InArgument>
                          <InArgument x:TypeArguments="s:Object[]" x:Key="Parameters">[New Object() { UpdateStep9_7 }]</InArgument>
                          <InArgument x:TypeArguments="s:Type" x:Key="TargetType">
                            <mxswa:ReferenceLiteral x:TypeArguments="s:Type" Value="x:Int32" />
                          </InArgument>
                          <OutArgument x:TypeArguments="x:Object" x:Key="Result">[UpdateStep9_6]</OutArgument>
                        </mxswa:ActivityReference.Arguments>
                      </mxswa:ActivityReference>
                      <mxswa:ActivityReference AssemblyQualifiedName="Microsoft.Crm.Workflow.Activities.EvaluateExpression, Microsoft.Crm.Workflow, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" DisplayName="EvaluateExpression">
                        <mxswa:ActivityReference.Arguments>
                          <InArgument x:TypeArguments="x:String" x:Key="ExpressionOperator">Add</InArgument>
                          <InArgument x:TypeArguments="s:Object[]" x:Key="Parameters">[New Object() { UpdateStep9_4, UpdateStep9_6 }]</InArgument>
                          <InArgument x:TypeArguments="s:Type" x:Key="TargetType">
                            <mxswa:ReferenceLiteral x:TypeArguments="s:Type" Value="x:Int32" />
                          </InArgument>
                          <OutArgument x:TypeArguments="x:Object" x:Key="Result">[UpdateStep9_3]</OutArgument>
                        </mxswa:ActivityReference.Arguments>
                      </mxswa:ActivityReference>
                      <mxswa:SetEntityProperty Attribute="north52_currentexecutioncount" Entity="[CreatedEntities(&quot;primaryEntity#Temp&quot;)]" EntityName="north52_schedule" Value="[UpdateStep9_3]">
                        <mxswa:SetEntityProperty.TargetType>
                          <InArgument x:TypeArguments="s:Type">
                            <mxswa:ReferenceLiteral x:TypeArguments="s:Type" Value="x:Int32" />
                          </InArgument>
                        </mxswa:SetEntityProperty.TargetType>
                      </mxswa:SetEntityProperty>
                      <mxswa:GetEntityProperty Attribute="north52_currentpagecount" Entity="[InputEntities(&quot;primaryEntity&quot;)]" EntityName="north52_schedule" Value="[UpdateStep9_10]">
                        <mxswa:GetEntityProperty.TargetType>
                          <InArgument x:TypeArguments="s:Type">
                            <mxswa:ReferenceLiteral x:TypeArguments="s:Type" Value="x:Int32" />
                          </InArgument>
                        </mxswa:GetEntityProperty.TargetType>
                      </mxswa:GetEntityProperty>
                      <mxswa:ActivityReference AssemblyQualifiedName="Microsoft.Crm.Workflow.Activities.EvaluateExpression, Microsoft.Crm.Workflow, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" DisplayName="EvaluateExpression">
                        <mxswa:ActivityReference.Arguments>
                          <InArgument x:TypeArguments="x:String" x:Key="ExpressionOperator">SelectFirstNonNull</InArgument>
                          <InArgument x:TypeArguments="s:Object[]" x:Key="Parameters">[New Object() { UpdateStep9_10 }]</InArgument>
                          <InArgument x:TypeArguments="s:Type" x:Key="TargetType">
                            <mxswa:ReferenceLiteral x:TypeArguments="s:Type" Value="x:Int32" />
                          </InArgument>
                          <OutArgument x:TypeArguments="x:Object" x:Key="Result">[UpdateStep9_9]</OutArgument>
                        </mxswa:ActivityReference.Arguments>
                      </mxswa:ActivityReference>
                      <mxswa:ActivityReference AssemblyQualifiedName="Microsoft.Crm.Workflow.Activities.EvaluateExpression, Microsoft.Crm.Workflow, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" DisplayName="EvaluateExpression">
                        <mxswa:ActivityReference.Arguments>
                          <InArgument x:TypeArguments="x:String" x:Key="ExpressionOperator">CreateCrmType</InArgument>
                          <InArgument x:TypeArguments="s:Object[]" x:Key="Parameters">[New Object() { Microsoft.Xrm.Sdk.Workflow.WorkflowPropertyType.Integer, "1" }]</InArgument>
                          <InArgument x:TypeArguments="s:Type" x:Key="TargetType">
                            <mxswa:ReferenceLiteral x:TypeArguments="s:Type" Value="x:Int32" />
                          </InArgument>
                          <OutArgument x:TypeArguments="x:Object" x:Key="Result">[UpdateStep9_12]</OutArgument>
                        </mxswa:ActivityReference.Arguments>
                      </mxswa:ActivityReference>
                      <mxswa:ActivityReference AssemblyQualifiedName="Microsoft.Crm.Workflow.Activities.EvaluateExpression, Microsoft.Crm.Workflow, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" DisplayName="EvaluateExpression">
                        <mxswa:ActivityReference.Arguments>
                          <InArgument x:TypeArguments="x:String" x:Key="ExpressionOperator">SelectFirstNonNull</InArgument>
                          <InArgument x:TypeArguments="s:Object[]" x:Key="Parameters">[New Object() { UpdateStep9_12 }]</InArgument>
                          <InArgument x:TypeArguments="s:Type" x:Key="TargetType">
                            <mxswa:ReferenceLiteral x:TypeArguments="s:Type" Value="x:Int32" />
                          </InArgument>
                          <OutArgument x:TypeArguments="x:Object" x:Key="Result">[UpdateStep9_11]</OutArgument>
                        </mxswa:ActivityReference.Arguments>
                      </mxswa:ActivityReference>
                      <mxswa:ActivityReference AssemblyQualifiedName="Microsoft.Crm.Workflow.Activities.EvaluateExpression, Microsoft.Crm.Workflow, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" DisplayName="EvaluateExpression">
                        <mxswa:ActivityReference.Arguments>
                          <InArgument x:TypeArguments="x:String" x:Key="ExpressionOperator">Add</InArgument>
                          <InArgument x:TypeArguments="s:Object[]" x:Key="Parameters">[New Object() { UpdateStep9_9, UpdateStep9_11 }]</InArgument>
                          <InArgument x:TypeArguments="s:Type" x:Key="TargetType">
                            <mxswa:ReferenceLiteral x:TypeArguments="s:Type" Value="x:Int32" />
                          </InArgument>
                          <OutArgument x:TypeArguments="x:Object" x:Key="Result">[UpdateStep9_8]</OutArgument>
                        </mxswa:ActivityReference.Arguments>
                      </mxswa:ActivityReference>
                      <mxswa:SetEntityProperty Attribute="north52_currentpagecount" Entity="[CreatedEntities(&quot;primaryEntity#Temp&quot;)]" EntityName="north52_schedule" Value="[UpdateStep9_8]">
                        <mxswa:SetEntityProperty.TargetType>
                          <InArgument x:TypeArguments="s:Type">
                            <mxswa:ReferenceLiteral x:TypeArguments="s:Type" Value="x:Int32" />
                          </InArgument>
                        </mxswa:SetEntityProperty.TargetType>
                      </mxswa:SetEntityProperty>
                      <mxswa:UpdateEntity DisplayName="UpdateStep9" Entity="[CreatedEntities(&quot;primaryEntity#Temp&quot;)]" EntityName="north52_schedule" />
                      <Assign x:TypeArguments="mxs:Entity" To="[InputEntities(&quot;primaryEntity&quot;)]" Value="[CreatedEntities(&quot;primaryEntity#Temp&quot;)]" />
                      <Persist />
                    </Sequence>
                    <mxswa:ActivityReference AssemblyQualifiedName="Microsoft.Crm.Workflow.Activities.ConditionSequence, Microsoft.Crm.Workflow, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" DisplayName="ConditionStep10: Check should the schedule be stopped">
                      <mxswa:ActivityReference.Arguments>
                        <InArgument x:TypeArguments="x:Boolean" x:Key="Wait">False</InArgument>
                      </mxswa:ActivityReference.Arguments>
                      <mxswa:ActivityReference.Properties>
                        <sco:Collection x:TypeArguments="Variable" x:Key="Variables">
                          <Variable x:TypeArguments="x:Boolean" Default="False" Name="ConditionBranchStep11_condition" />
                          <Variable x:TypeArguments="x:Object" Name="ConditionBranchStep11_1" />
                          <Variable x:TypeArguments="x:Object" Name="ConditionBranchStep11_2" />
                        </sco:Collection>
                        <sco:Collection x:TypeArguments="Activity" x:Key="Activities">
                          <mxswa:GetEntityProperty Attribute="north52_stopschedule" Entity="[InputEntities(&quot;primaryEntity&quot;)]" EntityName="north52_schedule" Value="[ConditionBranchStep11_1]">
                            <mxswa:GetEntityProperty.TargetType>
                              <InArgument x:TypeArguments="s:Type">
                                <mxswa:ReferenceLiteral x:TypeArguments="s:Type">
                                  <x:Null />
                                </mxswa:ReferenceLiteral>
                              </InArgument>
                            </mxswa:GetEntityProperty.TargetType>
                          </mxswa:GetEntityProperty>
                          <mxswa:ActivityReference AssemblyQualifiedName="Microsoft.Crm.Workflow.Activities.EvaluateExpression, Microsoft.Crm.Workflow, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" DisplayName="EvaluateExpression">
                            <mxswa:ActivityReference.Arguments>
                              <InArgument x:TypeArguments="x:String" x:Key="ExpressionOperator">CreateCrmType</InArgument>
                              <InArgument x:TypeArguments="s:Object[]" x:Key="Parameters">[New Object() { Microsoft.Xrm.Sdk.Workflow.WorkflowPropertyType.Boolean, "1" }]</InArgument>
                              <InArgument x:TypeArguments="s:Type" x:Key="TargetType">
                                <mxswa:ReferenceLiteral x:TypeArguments="s:Type" Value="x:Boolean" />
                              </InArgument>
                              <OutArgument x:TypeArguments="x:Object" x:Key="Result">[ConditionBranchStep11_2]</OutArgument>
                            </mxswa:ActivityReference.Arguments>
                          </mxswa:ActivityReference>
                          <mxswa:ActivityReference AssemblyQualifiedName="Microsoft.Crm.Workflow.Activities.EvaluateCondition, Microsoft.Crm.Workflow, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" DisplayName="EvaluateCondition">
                            <mxswa:ActivityReference.Arguments>
                              <InArgument x:TypeArguments="mxsq:ConditionOperator" x:Key="ConditionOperator">Equal</InArgument>
                              <InArgument x:TypeArguments="s:Object[]" x:Key="Parameters">[New Object() { ConditionBranchStep11_2 }]</InArgument>
                              <InArgument x:TypeArguments="x:Object" x:Key="Operand">[ConditionBranchStep11_1]</InArgument>
                              <OutArgument x:TypeArguments="x:Boolean" x:Key="Result">[ConditionBranchStep11_condition]</OutArgument>
                            </mxswa:ActivityReference.Arguments>
                          </mxswa:ActivityReference>
                          <mxswa:ActivityReference AssemblyQualifiedName="Microsoft.Crm.Workflow.Activities.ConditionBranch, Microsoft.Crm.Workflow, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" DisplayName="ConditionBranchStep11">
                            <mxswa:ActivityReference.Arguments>
                              <InArgument x:TypeArguments="x:Boolean" x:Key="Condition">[ConditionBranchStep11_condition]</InArgument>
                            </mxswa:ActivityReference.Arguments>
                            <mxswa:ActivityReference.Properties>
                              <mxswa:ActivityReference x:Key="Then" AssemblyQualifiedName="Microsoft.Crm.Workflow.Activities.Composite, Microsoft.Crm.Workflow, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" DisplayName="ConditionBranchStep11">
                                <mxswa:ActivityReference.Properties>
                                  <sco:Collection x:TypeArguments="Variable" x:Key="Variables" />
                                  <sco:Collection x:TypeArguments="Activity" x:Key="Activities">
                                    <Sequence DisplayName="StopWorkflowStep12: Stop the schedule">
                                      <Sequence.Variables>
                                        <Variable x:TypeArguments="x:Object" Name="StopWorkflowStep12_1" />
                                        <Variable x:TypeArguments="x:String" Default="2f95cf76-652d-41c7-bcee-8b9649b118e3" Name="stepLabelLabelId" />
                                        <Variable x:TypeArguments="x:String" Name="stepLabelDescription">
                                          <Variable.Default>
                                            <Literal x:TypeArguments="x:String" Value="" />
                                          </Variable.Default>
                                        </Variable>
                                        <Variable x:TypeArguments="x:Int32" Default="1033" Name="stepLabelLanguageCode" />
                                      </Sequence.Variables>
                                      <mxswa:ActivityReference AssemblyQualifiedName="Microsoft.Crm.Workflow.Activities.EvaluateExpression, Microsoft.Crm.Workflow, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" DisplayName="EvaluateExpression">
                                        <mxswa:ActivityReference.Arguments>
                                          <InArgument x:TypeArguments="x:String" x:Key="ExpressionOperator">CreateCrmType</InArgument>
                                          <InArgument x:TypeArguments="s:Object[]" x:Key="Parameters">[New Object() { Microsoft.Xrm.Sdk.Workflow.WorkflowPropertyType.String, "", "String" }]</InArgument>
                                          <InArgument x:TypeArguments="s:Type" x:Key="TargetType">
                                            <mxswa:ReferenceLiteral x:TypeArguments="s:Type" Value="x:String" />
                                          </InArgument>
                                          <OutArgument x:TypeArguments="x:Object" x:Key="Result">[StopWorkflowStep12_1]</OutArgument>
                                        </mxswa:ActivityReference.Arguments>
                                      </mxswa:ActivityReference>
                                      <TerminateWorkflow DisplayName="StopWorkflowStep12: Stop the schedule" Exception="[New Microsoft.Xrm.Sdk.InvalidPluginExecutionException(Microsoft.Xrm.Sdk.OperationStatus.Succeeded)]" Reason="[DirectCast(StopWorkflowStep12_1, System.String)]" />
                                    </Sequence>
                                  </sco:Collection>
                                </mxswa:ActivityReference.Properties>
                              </mxswa:ActivityReference>
                              <x:Null x:Key="Else" />
                            </mxswa:ActivityReference.Properties>
                          </mxswa:ActivityReference>
                        </sco:Collection>
                      </mxswa:ActivityReference.Properties>
                    </mxswa:ActivityReference>
                    <mxswa:StartChildWorkflow DisplayName="ChildWorkflowStep13: Go back to the start &amp; wait for the next run datetime" EntityId="[InputEntities(&quot;primaryEntity&quot;).Id]" EntityName="north52_schedule" WorkflowId="d5587dc7-0748-4ea5-baf0-04af796e36fb" />
                    <Persist />
                  </sco:Collection>
                </mxswa:ActivityReference.Properties>
              </mxswa:ActivityReference>
              <mxswa:Postpone x:Key="Else" BlockExecution="False" PostponeUntil="[DirectCast(WaitTimeoutStep4_2, System.DateTime)]" />
            </mxswa:ActivityReference.Properties>
          </mxswa:ActivityReference>
        </sco:Collection>
      </mxswa:ActivityReference.Properties>
    </mxswa:ActivityReference>
  </mxswa:Workflow>
</Activity>