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

ActionField498

Beschrijving: Create ContractLineCostMutations for ContractLineCostMutationCreate. Custom: Nee

Propertiesbewerken

Property Type Accessor
ContractLineCostMutationCreate ContractLineCostMutationCreate Root
MessageCode Code? Optional
WhenDoublePriceMutationsContinue RequestResult? Optional

XMLbewerken

<Workflow Name="ActionField498" Version="2025.07.28" WorkflowType="Standard" xmlns="urn:Ultimo.Framework.Workflow-mapping">
	<Security EditLevel="10" ViewLevel="20" UserContentLevel="30" />
	<Description>Create ContractLineCostMutations for ContractLineCostMutationCreate.</Description>
	<Properties>
		<Property	Name="ContractLineCostMutationCreate"				Type="ContractLineCostMutationCreate"	Accessor="Root"		Direction="In" />

		<Property	Name="MessageCode"									Type="Code?"							Accessor="Optional"	Direction="In" />
		<Property	Name="WhenDoublePriceMutationsContinue"				Type="RequestResult?"					Accessor="Optional"	Direction="In"		Default="Yes" />

		<Property	Name="ContractLineCostMutations"					Type="List[DomainObject]"				Accessor="Internal" />
		<Property	Name="DetailsCount"									Type="Int64"							Accessor="Internal"										Comment="Used to count several things that need to be validated" />
		<Property	Name="RentableRealEstateContractLineCostMutations"	Type="List[DomainObject]"				Accessor="Internal" />
	</Properties>
	<Execution>
		<UserContent Name="Pre" />

		<Validation Name="Create has been approved" Condition="${ContractLineCostMutationCreate.Status} != ContractLineCostMutationCreateStatus.Approved" MessageCode="1784" />
		<Validation Name="StartDate cannot be empty" Condition="${ContractLineCostMutationCreate.StartDate} != Empty" MessageCode="1751" />

		<Transaction>
			<GetCount Name="Count details for this mutation run" Type="ContractLineCostMutationCreateDetail" OutputProperty="${DetailsCount}">
				<Filters>
					<PropertyFilter	PropertyName="Id.ContractLineCostMutationCreate"	Operator="="		PropertyValue="${ContractLineCostMutationCreate}" />
				</Filters>
			</GetCount>

			<Validation Name="ValidateAtLeastOneDetailForRun" Condition="${DetailsCount} &gt; 0" MessageCode="2216" />

			<GetCount Name="Count details for this mutation run that have no NewPrice, NewPricePerDay and RaisePercentage" Type="ContractLineCostMutationCreateDetail" OutputProperty="${DetailsCount}">
				<Filters>
					<PropertyFilter	PropertyName="Id.ContractLineCostMutationCreate"	Operator="="		PropertyValue="${ContractLineCostMutationCreate}" />
					<PropertyFilter	PropertyName="NewPrice"								Operator="="		PropertyValue="CompanyMoney.Zero" />
					<PropertyFilter	PropertyName="NewPricePerDay"						Operator="="		PropertyValue="CompanyMoney.Zero" />
					<PropertyFilter	PropertyName="RaisePercentage"						Operator="="		PropertyValue="0" />
				</Filters>
			</GetCount>

			<Validation Name="NewPrice, NewPricePerDay and RaisePercentage cannot all be empty" Condition="${DetailsCount} == 0" MessageCode="1752" />

			<GetCount Name="Count details for this mutation run that have more than one of NewPrice, NewPricePerDay and RaisePercentage" Type="ContractLineCostMutationCreateDetail" OutputProperty="${DetailsCount}">
				<Filters>
					<PropertyFilter	PropertyName="Id.ContractLineCostMutationCreate"	Operator="="		PropertyValue="${ContractLineCostMutationCreate}" />
					<CombinedFilter FilterOperator="Or">
						<PropertyFilter	PropertyName="NewPrice"			Operator="!="		PropertyValue="CompanyMoney.Zero" />
						<PropertyFilter	PropertyName="NewPricePerDay"	Operator="!="		PropertyValue="CompanyMoney.Zero" />
						<PropertyFilter	PropertyName="RaisePercentage"	Operator="="		PropertyValue="0" />
					</CombinedFilter>
					<CombinedFilter FilterOperator="Or">
						<PropertyFilter	PropertyName="NewPrice"			Operator="="		PropertyValue="CompanyMoney.Zero" />
						<PropertyFilter	PropertyName="NewPricePerDay"	Operator="!="		PropertyValue="CompanyMoney.Zero" />
						<PropertyFilter	PropertyName="RaisePercentage"	Operator="!="		PropertyValue="0" />
					</CombinedFilter>
					<CombinedFilter FilterOperator="Or">
						<PropertyFilter	PropertyName="NewPrice"			Operator="!="		PropertyValue="CompanyMoney.Zero" />
						<PropertyFilter	PropertyName="NewPricePerDay"	Operator="="		PropertyValue="CompanyMoney.Zero" />
						<PropertyFilter	PropertyName="RaisePercentage"	Operator="!="		PropertyValue="0" />
					</CombinedFilter>
					<CombinedFilter FilterOperator="Or">
						<PropertyFilter	PropertyName="NewPrice"			Operator="!="		PropertyValue="CompanyMoney.Zero" />
						<PropertyFilter	PropertyName="NewPricePerDay"	Operator="!="		PropertyValue="CompanyMoney.Zero" />
						<PropertyFilter	PropertyName="RaisePercentage"	Operator="!="		PropertyValue="0" />
					</CombinedFilter>
				</Filters>
			</GetCount>

			<Validation Name="Just one of NewPrice, NewPricePerDay and RaisePercentage can have a value" Condition="${DetailsCount} == 0" MessageCode="1753" />

			<Comment><![CDATA[
				The command ContractLineCostMutationCreate_CreateContractLineCostMutations will be called 1 or 2 times, depending on the answer to the question in
				this WF when the first time around existing cost mutations are found on the same date as the StartDate.
				when answered positively, the existing mutations for that date will be removed and the command will be called a second time to create the cost mutations.
					]]></Comment>

			<Command Name="ContractLineCostMutationCreate_CreateContractLineCostMutations" CommandName="ContractLineCostMutationCreate_CreateContractLineCostMutations">
				<Parameter	Name="CheckWhetherRunCanProceed"		Direction="In"		Value="True" />
				<Parameter	Name="ContractLineCostMutationCreate"	Direction="In"		Value="${ContractLineCostMutationCreate}" />
				<Parameter	Name="ContractLineCostMutations"		Direction="Out"													OutputProperty="${ContractLineCostMutations}" />
				<Parameter	Name="MessageCode"						Direction="Out"													OutputProperty="${MessageCode}" />
			</Command>
		</Transaction>

		<When Name="If cost mutations are found for the same date as the StartDate" Condition="${MessageCode} != Empty">
			<Choose Name="Check which MessageCode was set">
				<When Name="When 2218" Condition="${MessageCode} == 2218" Comment="ViaRentableRealEstateContractLines">
					<Question Name="AskWhatToDoWhenDoublePriceMutationsExist" Type="YesNo" MessageCode="2218" OutputProperty="${WhenDoublePriceMutationsContinue}" />
				</When>


				<When Name="When 1852" Condition="${MessageCode} == 1852" Comment="ViaContractLines">
					<Question Name="AskWhatToDoWhenDoublePriceMutationsExist" Type="YesNo" MessageCode="1852" OutputProperty="${WhenDoublePriceMutationsContinue}" />
				</When>


				<When Name="When 2221" Condition="${MessageCode} == 2221" Comment="ViaContractLinesAndThenViaRentableRealEstateContractLines">
					<Question Name="AskWhatToDoWhenDoublePriceMutationsExist" Type="YesNo" MessageCode="2221" OutputProperty="${WhenDoublePriceMutationsContinue}" />
				</When>
			</Choose>
		</When>

		<When Name="Continue?" Condition="${WhenDoublePriceMutationsContinue} == Yes">
			<Transaction Comment="First remove all the old lines. Shouldn't be a problem for this to happen in a shift different from the one generating the new ones">
				<GetList Name="Get ContractLineCostMutations" Type="ContractLineCostMutation" OutputProperty="${ContractLineCostMutations}" OrderBy="Id" OrderDirection="Ascending">
					<Filters>
						<PropertyFilter	PropertyName="ContractLineCostMutationCreate.Id"	Operator="="		PropertyValue="${ContractLineCostMutationCreate.Id}" />
					</Filters>
				</GetList>

				<ForEach Name="Foreach found ContractLineCostMutation" In="${ContractLineCostMutations}" As="ContractLineCostMutation">
					<DeleteObject Name="Delete ContractLineCostMutation" DomainObject="${ContractLineCostMutation}" />
				</ForEach>

				<GetList Name="Get RentableRealEstateContractLineCostMutations" Type="RentableRealEstateContractLineCostMutation" OutputProperty="${RentableRealEstateContractLineCostMutations}" OrderBy="Id" OrderDirection="Ascending">
					<Filters>
						<PropertyFilter	PropertyName="ContractLineCostMutationCreate.Id"	Operator="="		PropertyValue="${ContractLineCostMutationCreate.Id}" />
					</Filters>
				</GetList>

				<ForEach Name="Foreach found RentableRealEstateContractLineCostMutation" In="${RentableRealEstateContractLineCostMutations}" As="RentableRealEstateContractLineCostMutation">
					<DeleteObject Name="Delete RentableRealEstateContractLineCostMutation" DomainObject="${RentableRealEstateContractLineCostMutation}" />
				</ForEach>
			</Transaction>

			<Transaction>
				<Command Name="ContractLineCostMutationCreate_CreateContractLineCostMutations" CommandName="ContractLineCostMutationCreate_CreateContractLineCostMutations">
					<Parameter	Name="ContractLineCostMutationCreate"	Direction="In"		Value="${ContractLineCostMutationCreate}" />
					<Parameter	Name="ContractLineCostMutations"		Direction="Out"													OutputProperty="${ContractLineCostMutations}" />
				</Command>
			</Transaction>

			<Message Name="Number of ContractLineCostMutations created" MessageCode="1750">
				<Parameter	Name="Count"	Direction="In"		Value="${ContractLineCostMutations.Count}" />
			</Message>
		</When>

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