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

ActionField486

Beschrijving: Create a RentableRealEstateContract (i.e. ServiceContract) from a RentableRealEstate. Custom: Nee

Propertiesbewerken

Property Type Accessor
RentableRealEstate Space Root

XMLbewerken

<Workflow Name="ActionField486" Version="2025.07.28" WorkflowType="Standard" xmlns="urn:Ultimo.Framework.Workflow-mapping">
	<Security EditLevel="10" ViewLevel="20" UserContentLevel="30" />
	<Description>Create a RentableRealEstateContract (i.e. ServiceContract) from a RentableRealEstate.</Description>
	<Properties>
		<Property	Name="RentableRealEstate"							Type="Space"											Accessor="Root"		Direction="In" />

		<Property	Name="ActiveServiceContracts"						Type="List[ContractPeriod]"								Accessor="Internal" />
		<Property	Name="ContractLine"									Type="ContractLine"										Accessor="Internal" />
		<Property	Name="ContractLineCostMutation"						Type="ContractLineCostMutation"							Accessor="Internal" />
		<Property	Name="ContractPeriod"								Type="ContractPeriod"									Accessor="Internal" />
		<Property	Name="Customer"										Type="Customer"											Accessor="Internal" />
		<Property	Name="Department"									Type="Department"										Accessor="Internal" />
		<Property	Name="EndDate"										Type="Date?"											Accessor="Internal" />
		<Property	Name="EndDateForContractLine"						Type="Date?"											Accessor="Internal" />
		<Property	Name="Indexable"									Type="Boolean"											Accessor="Internal" />
		<Property	Name="PreviousPriceForCostMutation"					Type="CompanyMoney"										Accessor="Internal" />
		<Property	Name="PreviousVatPercentageForCostMutation"			Type="Decimal"											Accessor="Internal" />
		<Property	Name="PreviousVatPriceForCostMutation"				Type="CompanyMoney"										Accessor="Internal" />
		<Property	Name="RentableRealEstateContractLineCostMutations"	Type="List[RentableRealEstateContractLineCostMutation]"	Accessor="Internal" />
		<Property	Name="RentableRealEstateContractLines"				Type="List[RentableRealEstateContractLine]"				Accessor="Internal" />
		<Property	Name="ServiceContract"								Type="ServiceContract"									Accessor="Internal" />
		<Property	Name="StartDate"									Type="Date"												Accessor="Internal" />
		<Property	Name="StartDateForContractLine"						Type="Date"												Accessor="Internal" />
		<Property	Name="StartDateForCostMutation"						Type="Date?"											Accessor="Internal" />
		<Property	Name="StateTimeslots"								Type="List[StateTimeslot]"								Accessor="Internal" />
	</Properties>
	<Execution>
		<UserContent Name="Pre" />

		<Validation Name="RentableObjectIsNotRentable" Condition="${RentableRealEstate.Rentable} == True" MessageCode="1709" />

		<Dialog Name="AskRentInformation" TitleCode="RENTINFORMATION">
			<Container>
				<Date Name="StartDate" OutputProperty="${StartDate}" Required="True" LabelCode="STARTDATE" />

				<Date Name="EndDate" OutputProperty="${EndDate}" Required="False" LabelCode="ENDDATE" />

				<SelectionList Name="Customer" OutputProperty="${Customer}" ColumnName="CusId" ViewfieldConfiguration="Verhuur" SqlWhereClause="CusContext=1" />

				<SelectionList Name="Department" OutputProperty="${Department}" ColumnName="DepId" ViewfieldConfiguration="Verhuur" />
			</Container>
		</Dialog>

		<Validation Name="Only one renter allowed" Condition="${Customer} == Empty || ${Department} == Empty" MessageCode="1707" />
		<Validation Name="At least one renter required" Condition="${Customer} != Empty || ${Department} != Empty" MessageCode="1708" />
		<Validation Name="StartDate after RREStartDate" Condition="${StartDate} &gt;= ${RentableRealEstate.RentableRealEstateStartDate}" MessageCode="1741">
			<Parameter	Name="RentableRealEstate"	Direction="In"		Value="${RentableRealEstate}" />
		</Validation>
		<Validation Name="StartDate must be before EndDate" Condition="${EndDate} == Empty || ${EndDate} &gt;= ${StartDate}" MessageCode="1832" />

		<Transaction>
			<GetList Name="Get list of details" Type="RentableRealEstateContractLine" OutputProperty="${RentableRealEstateContractLines}" OrderBy="Id" OrderDirection="Ascending">
				<Filters>
					<PropertyFilter	PropertyName="Space.Id"	Operator="="		PropertyValue="${RentableRealEstate.Id}" />
					<CombinedFilter FilterOperator="Or">
						<PropertyFilter	PropertyName="EndDate"	Operator="&gt;="	PropertyValue="${StartDate}" />
						<PropertyEmptyFilter PropertyName="EndDate" />
					</CombinedFilter>
				</Filters>
			</GetList>

			<GetList Name="Get list of active Contracts for this time period" Type="ContractPeriod" OutputProperty="${ActiveServiceContracts}" OrderBy="Id" OrderDirection="Ascending">
				<Joins>
					<Join	Name="ServiceContract"	Alias="svc"	Type="InnerJoin" />
					<Join	Name="svc.Space"		Alias="spc"	Type="InnerJoin" />
				</Joins>
				<Filters>
					<PropertyFilter	PropertyName="spc.Id"		Operator="="		PropertyValue="${RentableRealEstate.Id}" />
					<PropertyFilter	PropertyName="svc.Context"	Operator="="		PropertyValue="ServiceContractContext.RentalContract" />
					<PropertyFilter	PropertyName="svc.Status"	Operator="="		PropertyValue="ServiceContractStatus.Active" />
					<PropertyFilter	PropertyName="DateFrom"		Operator="&lt;="	PropertyValue="${EndDate}" />
					<CombinedFilter FilterOperator="Or">
						<PropertyFilter	PropertyName="DateTill"	Operator="&gt;="	PropertyValue="${StartDate}" />
						<PropertyEmptyFilter PropertyName="DateTill" />
					</CombinedFilter>
				</Filters>
			</GetList>

			<Validation Name="There shouldn't be any active contracts in this time period" Condition="${ActiveServiceContracts.Count} == 0" MessageCode="1711" />

			<Command Name="Are there any blocking StateTimeslots in this period" CommandName="StateAgenda_FindTimeslots">
				<Parameter	Name="EndDate"			Direction="In"		Value="${EndDate}" />
				<Parameter	Name="StartDate"		Direction="In"		Value="${StartDate}" />
				<Parameter	Name="StateAgenda"		Direction="In"		Value="${RentableRealEstate.StateAgenda}" />
				<Parameter	Name="Statuses"			Direction="In"		Value="=StateTimeslotStatus.Blocked, StateTimeslotStatus.Disused" />
				<Parameter	Name="StateTimeslots"	Direction="Out"																			OutputProperty="${StateTimeslots}" />
			</Command>

			<Validation Name="There shouldn't be any blocking timeslots in this time period" Condition="${StateTimeslots.Count} == 0" MessageCode="1747" />

			<Insert Name="Create ServiceContract" ObjectType="ServiceContract" OutputProperty="${ServiceContract}">
				<Parameter	Name="Context"		Direction="In"		Value="ServiceContractContext.RentalContract" />
				<Parameter	Name="Status"		Direction="In"		Value="ServiceContractStatus.Concept" />
				<Parameter	Name="Customer"		Direction="In"		Value="${Customer}" />
				<Parameter	Name="Department"	Direction="In"		Value="${Department}" />
				<Parameter	Name="Payer"		Direction="In"		Value="${Customer}" />
				<Parameter	Name="Space"		Direction="In"		Value="${RentableRealEstate}" />
				<Parameter	Name="StartDate"	Direction="In"		Value="${StartDate}" />
				<Parameter	Name="Vendor"		Direction="In"		Value="${RentableRealEstate.Vendor}" />
			</Insert>

			<Insert Name="Create ContractPeriod" ObjectType="ContractPeriod" OutputProperty="${ContractPeriod}">
				<Parameter	Name="DateFrom"			Direction="In"		Value="${StartDate}" />
				<Parameter	Name="DateTill"			Direction="In"		Value="${EndDate}" />
				<Parameter	Name="ServiceContract"	Direction="In"		Value="${ServiceContract}" />
			</Insert>

			<ForEach Name="Foreach found RentableRealEstateContractLine" In="${RentableRealEstateContractLines}" As="RentableRealEstateContractLine">
				<Command Name="RentableRealEstateContractLine_FindRelevantCostMutations" CommandName="RentableRealEstateContractLine_FindRelevantCostMutations">
					<Parameter	Name="LeaveOutCostMutationsIrrelevantForInvoiceOnceContractLines"	Direction="In"		Value="True" />
					<Parameter	Name="RentableRealEstateContractLine"								Direction="In"		Value="${RentableRealEstateContractLine}" />
					<Parameter	Name="StartDate"													Direction="In"		Value="${StartDate}" />
					<Parameter	Name="RentableRealEstateContractLineCostMutations"					Direction="Out"													OutputProperty="${RentableRealEstateContractLineCostMutations}" />
				</Command>

				<When Name="No ContractLine if there are no valid mutation lines" Condition="${RentableRealEstateContractLineCostMutations.Count} &gt; 0 &amp;&amp; (${EndDate} == Empty || ${RentableRealEstateContractLine.StartDate} == Empty || ${RentableRealEstateContractLine.StartDate} &lt;= ${EndDate}) &amp;&amp; (${RentableRealEstateContractLine.EndDate} == Empty || ${RentableRealEstateContractLine.EndDate} &gt; ${StartDate})">
					<Assign Name="Set StartDate" Property="${StartDateForContractLine}" Value="${StartDate}" />

					<When Name="if date on contractline is greater than startdate use it" Condition="${RentableRealEstateContractLine.StartDate} != Empty &amp;&amp; ${RentableRealEstateContractLine.StartDate} &gt; ${StartDate}">
						<Assign Name="Assign StartDateForContractLine" Property="${StartDateForContractLine}" Value="${RentableRealEstateContractLine.StartDate}" />
					</When>

					<Assign Name="Set EndDate" Property="${EndDateForContractLine}" Value="${RentableRealEstateContractLine.EndDate}" />
					<Assign Name="Set Indexable" Property="${Indexable}" Value="${RentableRealEstateContractLine.Indexable}" />

					<When Name="When contract line is a one-time component, overrule EndDate and Indexable" Condition="${RentableRealEstateContractLine.InvoiceOnce} == True">
						<Assign Name="Assign EndDateForContractLine" Property="${EndDateForContractLine}" Value="${StartDate}" />
						<Assign Name="Assign Indexable" Property="${Indexable}" Value="False" />
					</When>

					<Insert Name="Create ContractLine" ObjectType="ContractLine" OutputProperty="${ContractLine}">
						<Parameter	Name="Status"			Direction="In"		Value="ContractLineStatus.Concept" />
						<Parameter	Name="ChargeFrequency"	Direction="In"		Value="${RentableRealEstateContractLine.ChargeFrequency}" />
						<Parameter	Name="ChargeMoment"		Direction="In"		Value="${RentableRealEstateContractLine.ChargeMoment}" />
						<Parameter	Name="ContractLineType"	Direction="In"		Value="${RentableRealEstateContractLine.ContractLineType}" />
						<Parameter	Name="CostCenter"		Direction="In"		Value="${RentableRealEstateContractLine.CostCenter}" />
						<Parameter	Name="CostType"			Direction="In"		Value="${RentableRealEstateContractLine.CostType}" />
						<Parameter	Name="Description"		Direction="In"		Value="${RentableRealEstateContractLine.Description}" />
						<Parameter	Name="EndDate"			Direction="In"		Value="${EndDateForContractLine}" />
						<Parameter	Name="Indexable"		Direction="In"		Value="${Indexable}" />
						<Parameter	Name="InvoiceOnce"		Direction="In"		Value="${RentableRealEstateContractLine.InvoiceOnce}" />
						<Parameter	Name="Price"			Direction="In"		Value="${RentableRealEstateContractLine.Price}" />
						<Parameter	Name="PricePerDay"		Direction="In"		Value="${RentableRealEstateContractLine.PricePerDay}" />
						<Parameter	Name="ServiceContract"	Direction="In"		Value="${ServiceContract}" />
						<Parameter	Name="Space"			Direction="In"		Value="${RentableRealEstate}" />
						<Parameter	Name="StartDate"		Direction="In"		Value="${StartDateForContractLine}" />
						<Parameter	Name="Vat"				Direction="In"		Value="${RentableRealEstateContractLine.Vat}" />
					</Insert>

					<ForEach Name="Foreach found RentableRealEstateContractLineCostMutation" In="${RentableRealEstateContractLineCostMutations}" As="RentableRealEstateContractLineCostMutation">
						<Assign Name="Assign the startdate of rrecm to cm" Property="${StartDateForCostMutation}" Value="${RentableRealEstateContractLineCostMutation.StartDate}" />
						<Assign Name="Assign the previous price of rrecm to cm" Property="${PreviousPriceForCostMutation}" Value="${RentableRealEstateContractLineCostMutation.PreviousPrice}" />
						<Assign Name="Assign the previous vat price of rrecm to cm" Property="${PreviousVatPriceForCostMutation}" Value="${RentableRealEstateContractLineCostMutation.PreviousVatPrice}" />
						<Assign Name="Assign the previous vat percentage of rrecm to cm" Property="${PreviousVatPercentageForCostMutation}" Value="${RentableRealEstateContractLineCostMutation.PreviousVatPercentage}" />

						<When Name="When start date on mutation is unfilled, before or on the start of the contract" Condition="${StartDateForCostMutation} == Empty || ${StartDateForCostMutation} &lt;= ${StartDateForContractLine}">
							<Assign Name="Assign startdate of contractline to that of costmutation" Property="${StartDateForCostMutation}" Value="${StartDateForContractLine}" />
							<Assign Name="Assign previous price as zero" Property="${PreviousPriceForCostMutation}" Value="0" Comment="Treat the new mutation as initial" />
							<Assign Name="Assign previous vat price as zero" Property="${PreviousVatPriceForCostMutation}" Value="0" Comment="Treat the new mutation as initial" />
							<Assign Name="Assign previous vat percentage as zero" Property="${PreviousVatPercentageForCostMutation}" Value="0" Comment="Treat the new mutation as initial" />
						</When>

						<Insert Name="Create ContractLineCostMutation" ObjectType="ContractLineCostMutation" OutputProperty="${ContractLineCostMutation}">
							<Parameter	Name="Status"					Direction="In"		Value="ContractLineCostMutationStatus.Concept" />
							<Parameter	Name="ContractLine"				Direction="In"		Value="${ContractLine}" />
							<Parameter	Name="Description"				Direction="In"		Value="${RentableRealEstateContractLineCostMutation.Description}" />
							<Parameter	Name="Employee"					Direction="In"		Value="${RentableRealEstateContractLineCostMutation.Employee}" />
							<Parameter	Name="PreviousPrice"			Direction="In"		Value="${PreviousPriceForCostMutation}" />
							<Parameter	Name="PreviousVatPercentage"	Direction="In"		Value="${PreviousVatPercentageForCostMutation}" />
							<Parameter	Name="PreviousVatPrice"			Direction="In"		Value="${PreviousVatPriceForCostMutation}" />
							<Parameter	Name="Price"					Direction="In"		Value="${RentableRealEstateContractLineCostMutation.Price}" />
							<Parameter	Name="PricePerDay"				Direction="In"		Value="${RentableRealEstateContractLineCostMutation.PricePerDay}" />
							<Parameter	Name="StartDate"				Direction="In"		Value="${StartDateForCostMutation}" />
							<Parameter	Name="Vat"						Direction="In"		Value="${RentableRealEstateContractLineCostMutation.Vat}" />
							<Parameter	Name="VatPercentage"			Direction="In"		Value="${RentableRealEstateContractLineCostMutation.VatPercentage}" />
							<Parameter	Name="VatPrice"					Direction="In"		Value="${RentableRealEstateContractLineCostMutation.VatPrice}" />
						</Insert>

						<ChangeStatus Name="Change status of to Approved" DomainObject="${ContractLineCostMutation}" NewStatus="ContractLineCostMutationStatus.Approved" />
					</ForEach>

					<ChangeStatus Name="Change status of ContractLine" DomainObject="${ContractLine}" NewStatus="ContractLineStatus.Active" />
				</When>
			</ForEach>
		</Transaction>

		<UserContent Name="Post" />

		<View Name="OpenScreen" ViewName="DataEntryScreen">
			<Parameter	Name="DomainObject"			Direction="In"		Value="${ServiceContract}" />
			<Parameter	Name="FocusEditableField"	Direction="In"		Value="=${ServiceContract.Description} == Empty" />
		</View>
	</Execution>
</Workflow>