Share via


Provisioning Schema::when

Element that checks for the presence of an element, attribute, or value (of an element or attribute) in a procedure's select node. The associated execution block is executed whenever the condition in the when node evaluates to true. This element is part of the provisioning schema of Microsoft Provisioning Framework (MPF).

Arguments

Input Argument Description

case

Optional. This attribute must be specified with select attribute.

select

Optional. Name of one of the select nodes previously defined in the scope of the executing procedure.

source

Optional. Context node for locating the sourcePath node in the Requests [HMC SDK] XML:

sourcePath

Optional. XPath for the element and attribute to check.

Note

Use either the source and sourcePath attributes or the select and case attributes, but not both.

Remarks

No remarks.

Sample Code

Example XML Request

<request> 
  <data> 
    <organizations> 
      <organization name="tailspintoys.com"> 
        <count>1</count>  
        <users />  
      </organization> 
      <organization name="wideworldimporters.com"> 
        <count>1</count>  
      </organization> 
    </organizations> 
    <service>myHosting</service>  
  </data> 
  <procedure> 
    <!--  Select type of service organization to provision. --> 
    <select name="service" source="data" sourcePath="service" defaultCase="4" ifNullCase="4"> 
      <where value="myHosting" case="1" />  
      <where value="myInbox" case="2" />  
      <where value="myCalendar" case="3" />  
      <where value="myProfile" case="3" />  
    </select> 
    <!-- Execute procedure when service name is myHosting. Execute procedure multiple times based on count. --> 
    <execute namespace="Test Namespace" procedure="Read Request"> 
      <forEach root="data" path="organizations/organization" name="org" />  
      <repeat source="org" sourcePath="count" />  
      <executeData service="myHosting" />  
      <when select="service" case="1" />  
      <after source="executeData" destination="data" />  
    </execute> 
    <!-- Execute procedure when service name is myInbox. --> 
    <execute namespace="Test Namespace" procedure="Read Request"> 
      <executeData service="myInbox" />  
      <when select="service" case="2" />  
      <after source="executeData" destination="data" /> 
    </execute> 
    <!-- Execute procedure only when users are present for the organization. --> 
    <execute namespace="Test Namespace" procedure="Read Request"> 
      <forEach root="data" path="organizations/organization" name="org" /> 
      <when source="org" sourcePath="users" /> 
      <after source="executeData" destination="data" /> 
    </execute> 
  </procedure> 
</request>

Applies To

Provisioning Schema; Provisioning Schema::execute; Provisioning Schema::queue; Provisioning Schema::transform

See also

Tasks

Provisioning Schema::execute
Provisioning Schema::queue
Provisioning Schema::transform
Provisioning Schema::select
Provisioning Schema::data
Provisioning Schema::procedureData
Provisioning Schema::forEach