Categorie: reference Bijgewerkt: 2026-04-08 actionfield workflow actionfield942

ActionField942

Beschrijving: Change status of ServiceContract (RentableRealEstateContract) to Active. Custom: Nee

Propertiesbewerken

Property Type Accessor
RentableRealEstateContract ServiceContract Root
LettableUnitIsRequired Boolean Optional

XMLbewerken

<Workflow Name="ActionField942" Version="2025.07.28" WorkflowType="Standard" xmlns="urn:Ultimo.Framework.Workflow-mapping">
	<Security EditLevel="10" ViewLevel="20" UserContentLevel="30" />
	<Description>Change status of ServiceContract (RentableRealEstateContract) to Active.</Description>
	<Properties>
		<Property	Name="RentableRealEstateContract"	Type="ServiceContract"		Accessor="Root"		Direction="In" />

		<Property	Name="LettableUnitIsRequired"		Type="Boolean"				Accessor="Optional"	Direction="In"		Default="True"	Comment="Caution: do not use False if you use ActionField942 in the rental administration." />

		<Property	Name="ContractLines"				Type="List[ContractLine]"	Accessor="Internal" />
		<Property	Name="ContractPeriods"				Type="List[ContractPeriod]"	Accessor="Internal" />
		<Property	Name="CountStateStateTimeslot"		Type="Int64"				Accessor="Internal"						Default="0" />
		<Property	Name="NewRentedPeriod"				Type="StateTimeslot"		Accessor="Internal" />
		<Property	Name="StateAgenda"					Type="StateAgenda"			Accessor="Internal" />
		<Property	Name="StateTimeslots"				Type="List[StateTimeslot]"	Accessor="Internal" />
	</Properties>
	<Execution>
		<UserContent Name="Pre" />

		<Transaction>
			<When Name="When Lettable Unit is required #1" Condition="${LettableUnitIsRequired} == True">
				<Validation Name="Space must be rentable" Condition="${RentableRealEstateContract.Space.Rentable?} == True" MessageCode="1844">
					<Parameter	Name="ServiceContract"	Direction="In"		Value="${RentableRealEstateContract}" />
				</Validation>
			</When>

			<GetList Name="GetListOfContractPeriods" Type="ContractPeriod" OutputProperty="${ContractPeriods}" OrderBy="Id" OrderDirection="Ascending">
				<Filters>
					<PropertyFilter	PropertyName="ServiceContract"	Operator="="		PropertyValue="${RentableRealEstateContract}" />
				</Filters>
			</GetList>

			<ForEach Name="CheckEachContractPeriod" In="${ContractPeriods}" As="CheckContractPeriod" Condition="${CountStateStateTimeslot} == 0">
				<Validation Name="StartDate must be before EndDate" Condition="${CheckContractPeriod.DateTill} == Empty || ${CheckContractPeriod.DateTill} &gt;= ${CheckContractPeriod.DateFrom}" MessageCode="1831">
					<Parameter	Name="ContractPeriod"	Direction="In"		Value="${CheckContractPeriod}" />
					<Parameter	Name="ServiceContract"	Direction="In"		Value="${RentableRealEstateContract}" />
				</Validation>

				<When Name="When Lettable Unit is required #2" Condition="${LettableUnitIsRequired} == True">
					<Command Name="Check dates against StateAgenda" CommandName="StateAgenda_FindTimeslots">
						<Parameter	Name="EndDate"			Direction="In"		Value="${CheckContractPeriod.DateTill}" />
						<Parameter	Name="StartDate"		Direction="In"		Value="${CheckContractPeriod.DateFrom}" />
						<Parameter	Name="StateAgenda"		Direction="In"		Value="${RentableRealEstateContract.Space.StateAgenda}" />
						<Parameter	Name="StateTimeslots"	Direction="Out"																OutputProperty="${StateTimeslots}" />
					</Command>

					<Assign Name="Set count" Property="${CountStateStateTimeslot}" Value="${StateTimeslots.Count}" />
					<Validation Name="StateTimeslotsconflict" Condition="${StateTimeslots.Count} == 0" MessageCode="1767">
						<Parameter	Name="ContractPeriod"	Direction="In"		Value="${CheckContractPeriod}" />
						<Parameter	Name="ServiceContract"	Direction="In"		Value="${RentableRealEstateContract}" />
						<Parameter	Name="StateTimeslots"	Direction="In"		Value="${StateTimeslots}" />
					</Validation>
				</When>
			</ForEach>

			<ChangeStatus Name="Activate rentablerealestatecontract" DomainObject="${RentableRealEstateContract}" NewStatus="ServiceContractStatus.Active" />

			<ForEach Name="LoopEachContractPeriod" In="${ContractPeriods}" As="CurrentContractPeriod">
				<When Name="StateAgenda exist" Condition="${LettableUnitIsRequired} == True &amp;&amp; ${RentableRealEstateContract.Space.StateAgenda} == Empty">
					<Insert Name="Create StateAgenda" ObjectType="StateAgenda" OutputProperty="${StateAgenda}" />

					<Assign Name="Assign StateAgenda to space" Property="${RentableRealEstateContract.Space.StateAgenda}" Value="${StateAgenda}" />
				</When>

				<Insert Name="Create new rented period" ObjectType="StateTimeslot" OutputProperty="${NewRentedPeriod}">
					<Parameter	Name="Status"		Direction="In"		Value="StateTimeslotStatus.Rented" />
					<Parameter	Name="Employee"		Direction="In"		Value="#{User.EmployeeId}" />
					<Parameter	Name="EndDate"		Direction="In"		Value="${CurrentContractPeriod.DateTill}" />
					<Parameter	Name="StartDate"	Direction="In"		Value="${CurrentContractPeriod.DateFrom}" />
					<Parameter	Name="StateAgenda"	Direction="In"		Value="=${LettableUnitIsRequired} == True ? ${RentableRealEstateContract.Space.StateAgenda} : EMPTY" />
				</Insert>

				<Assign Name="Assign StateTimeslot" Property="${CurrentContractPeriod.StateTimeslot}" Value="${NewRentedPeriod}" />
			</ForEach>
		</Transaction>

		<UserContent Name="Post" />
	</Execution>
</Workflow>