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

ActionField478

Beschrijving: Change status of all ContractLineCostMutations linked to ContractLineCostMutationCreate to Approved. Custom: Nee

Propertiesbewerken

Property Type Accessor
ContractLineCostMutationCreate ContractLineCostMutationCreate Root
AutoAnswerToQuestion RequestResult? Optional

XMLbewerken

<Workflow Name="ActionField478" Version="2025.07.28" WorkflowType="Standard" xmlns="urn:Ultimo.Framework.Workflow-mapping">
	<Security EditLevel="10" ViewLevel="20" UserContentLevel="30" />
	<Description>Change status of all ContractLineCostMutations linked to ContractLineCostMutationCreate to Approved.</Description>
	<Properties>
		<Property	Name="ContractLineCostMutationCreate"				Type="ContractLineCostMutationCreate"					Accessor="Root"		Direction="In" />

		<Property	Name="AutoAnswerToQuestion"							Type="RequestResult?"									Accessor="Optional"	Direction="In"		Default="Empty"	Comment="Auto answer for Question 1810 (Yes/No/Empty)" />

		<Property	Name="Answer"										Type="RequestResult?"									Accessor="Internal" />
		<Property	Name="ContractLine"									Type="ContractLine"										Accessor="Internal" />
		<Property	Name="ContractLineCostMutations"					Type="List[ContractLineCostMutation]"					Accessor="Internal" />
		<Property	Name="Count"										Type="Int64"											Accessor="Internal" />
		<Property	Name="RentableRealEstateContractLine"				Type="RentableRealEstateContractLine"					Accessor="Internal" />
		<Property	Name="RentableRealEstateContractLineCostMutations"	Type="List[RentableRealEstateContractLineCostMutation]"	Accessor="Internal" />
	</Properties>
	<Execution>
		<UserContent Name="Pre" />

		<Transaction>
			<Validation Name="Run already approved" Condition="${ContractLineCostMutationCreate.Status} != ContractLineCostMutationCreateStatus.Approved" MessageCode="1836">
				<Parameter	Name="ContractLineCostMutationCreate"	Direction="In"		Value="${ContractLineCostMutationCreate}" />
			</Validation>

			<Command Name="Check whether there are approved clcms" CommandName="ContractLineCostMutationCreate_CheckApprovedCostMutations">
				<Parameter	Name="ContractLineCostMutationCreate"	Direction="In"		Value="${ContractLineCostMutationCreate}" />
				<Parameter	Name="CountOfApprovedCostMutations"		Direction="Out"													OutputProperty="${Count}" />
			</Command>

			<Validation Name="Assert that count == 0" Condition="${Count} == 0" MessageCode="1835">
				<Parameter	Name="ContractLineCostMutationCreate"	Direction="In"		Value="${ContractLineCostMutationCreate}" />
			</Validation>

			<GetCount Name="Check whether there are are any open internal chargeline records associated with the run (thru contractline). If so, bail out" Type="InternalChargeLine" OutputProperty="${Count}">
				<Joins>
					<Join	Name="ContractLine"					Alias="cl"		Type="LeftOuterJoin" />
					<Join	Name="cl.ContractLineCostMutations"	Alias="clcm"	Type="LeftOuterJoin" />
				</Joins>
				<Filters>
					<PropertyFilter	PropertyName="clcm.ContractLineCostMutationCreate.Id"	Operator="="		PropertyValue="${ContractLineCostMutationCreate.Id}" />
					<PropertyFilter	PropertyName="Status"									Operator="="		PropertyValue="InternalChargeLineStatus.Open" />
					<PropertyFilter	PropertyName="clcm.StartDate"							Operator="&gt;="	PropertyValue="%PeriodFromDate" />
					<PropertyFilter	PropertyName="clcm.StartDate"							Operator="&lt;"		PropertyValue="%PeriodTillDate" />
				</Filters>
			</GetCount>

			<Validation Name="Count of open InternalChargeLines should be zero" Condition="${Count} == 0" MessageCode="1853">
				<Parameter	Name="ContractLineCostMutationCreate"	Direction="In"		Value="${ContractLineCostMutationCreate}" />
			</Validation>

			<GetList Name="Get ContractLineCostMutations" Type="ContractLineCostMutation" OutputProperty="${ContractLineCostMutations}" OrderBy="Id" OrderDirection="Ascending">
				<Joins>
					<Join	Name="ContractLine"			Alias="cl"	Type="InnerJoin" />
					<Join	Name="cl.ServiceContract"	Alias="svc"	Type="InnerJoin" />
				</Joins>
				<Filters>
					<PropertyFilter	PropertyName="ContractLineCostMutationCreate.Id"	Operator="="		PropertyValue="${ContractLineCostMutationCreate.Id}" />
					<PropertyFilter	PropertyName="cl.Indexable"							Operator="="		PropertyValue="True" />
				</Filters>
			</GetList>
		</Transaction>

		<ForEach Name="For all ContractLineCostMutations associated with the run, check if correction is needed" In="${ContractLineCostMutations}" As="ContractLineCostMutation" Condition="${Answer} == Empty">
			<Assign Name="Assign ContractLine" Property="${ContractLine}" Value="${ContractLineCostMutation.ContractLine}" />

			<When Name="Check date" Condition="${ContractLine.StartDateChargePeriod} != Empty &amp;&amp; ${ContractLine.StartDate} &lt; ${ContractLine.StartDateChargePeriod} &amp;&amp; ${ContractLineCostMutation.StartDate} &lt; ${ContractLine.StartDateChargePeriod}" Comment="Is the startdate of this cost mutation smaller than the date of previous invoice, then make a correction contract line; if the contract has never been charged (ContractLine.StartDateChargePeriod is not greater than ContractLine.StartDate), this code has to be skipped">
				<Assign Name="Assign Answer" Property="${Answer}" Value="${AutoAnswerToQuestion}" />

				<When Name="AutoAnswerToQuestion has no value?" Condition="${AutoAnswerToQuestion} == Empty">
					<Question Name="Ask whether changes must be applied retroactively" Type="YesNo" MessageCode="1810" Default="Yes" OutputProperty="${Answer}" />
				</When>
			</When>
		</ForEach>

		<Transaction>
			<When Name="test whether set contains any records" Condition="${ContractLineCostMutations.Count} &gt; 0">
				<ForEach Name="Approve all ContractLineCostMutations associated with the run" In="${ContractLineCostMutations}" As="ContractLineCostMutation">
					<When Name="Answer is yes" Condition="${Answer} == Yes &amp;&amp; ${ContractLineCostMutation.ContractLine.ServiceContract.Status} == ServiceContractStatus.Active">
						<WorkflowCall Name="Create Correction ContractLine" WorkflowName="ContractLineCostMutation_CreateCorrectionContractLine">
							<Parameter	Name="ContractLineCostMutation"	Direction="In"		Value="${ContractLineCostMutation}" />
						</WorkflowCall>
					</When>

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

				<ChangeStatus Name="Change status of run record" DomainObject="${ContractLineCostMutationCreate}" NewStatus="ContractLineCostMutationCreateStatus.Approved" />
			</When>

			<GetCount Name="Check whether there are RentableRealEstateContractLineCostMutations associated with this run not having the status Concept; if so, bail out" Type="RentableRealEstateContractLineCostMutation" OutputProperty="${Count}">
				<Joins>
					<Join	Name="RentableRealEstateContractLine"	Alias="rcl"	Type="InnerJoin" />
				</Joins>
				<Filters>
					<PropertyFilter	PropertyName="ContractLineCostMutationCreate.Id"	Operator="="		PropertyValue="${ContractLineCostMutationCreate.Id}" />
					<PropertyFilter	PropertyName="Status"								Operator="!="		PropertyValue="RentableRealEstateContractLineCostMutationStatus.Concept" />
					<PropertyFilter	PropertyName="rcl.Indexable"						Operator="="		PropertyValue="True" />
				</Filters>
			</GetCount>

			<Validation Name="Assert that count == 0" Condition="${Count} == 0" MessageCode="1835">
				<Parameter	Name="ContractLineCostMutationCreate"	Direction="In"		Value="${ContractLineCostMutationCreate}" />
			</Validation>

			<GetList Name="Get RentableRealEstateContractLineCostMutations" Type="RentableRealEstateContractLineCostMutation" OutputProperty="${RentableRealEstateContractLineCostMutations}" OrderBy="Id" OrderDirection="Ascending">
				<Joins>
					<Join	Name="RentableRealEstateContractLine"	Alias="rcl"	Type="InnerJoin" />
				</Joins>
				<Filters>
					<PropertyFilter	PropertyName="ContractLineCostMutationCreate.Id"	Operator="="		PropertyValue="${ContractLineCostMutationCreate.Id}" />
					<PropertyFilter	PropertyName="rcl.Indexable"						Operator="="		PropertyValue="True" />
				</Filters>
			</GetList>

			<When Name="test whether set contains any records" Condition="${RentableRealEstateContractLineCostMutations.Count} &gt; 0">
				<ForEach Name="Approve all RentableRealEstateContractLineCostMutations associated with the run" In="${RentableRealEstateContractLineCostMutations}" As="RentableRealEstateContractLineCostMutation">
					<ChangeStatus Name="Change status of RentableRealEstateContractLineCostMutation" DomainObject="${RentableRealEstateContractLineCostMutation}" NewStatus="RentableRealEstateContractLineCostMutationStatus.Approved" />
				</ForEach>

				<ChangeStatus Name="Change status of run record" DomainObject="${ContractLineCostMutationCreate}" NewStatus="ContractLineCostMutationCreateStatus.Approved" />
			</When>
		</Transaction>

		<Choose Name="Display message based on SearchMode on the Create">
			<When Name="When searching via RentableRealEstateContractLines" Condition="${ContractLineCostMutationCreate.SearchMode} == ViaRentableRealEstateContractLines">
				<Message Name="MessageApproved" MessageCode="2226">
					<Parameter	Name="ContractLineCostMutationCreate"	Direction="In"		Value="${ContractLineCostMutationCreate}" />
					<Parameter	Name="RRECLCMCount"						Direction="In"		Value="${RentableRealEstateContractLineCostMutations.Count}" />
				</Message>
			</When>


			<When Name="When searching via ContractLines" Condition="${ContractLineCostMutationCreate.SearchMode} == ViaContractLines">
				<Message Name="MessageApproved" MessageCode="2227">
					<Parameter	Name="CLCMCount"						Direction="In"		Value="${ContractLineCostMutations.Count}" />
					<Parameter	Name="ContractLineCostMutationCreate"	Direction="In"		Value="${ContractLineCostMutationCreate}" />
				</Message>
			</When>


			<When Name="When searching via ContractLines and then via RentableRealEstateContractLines" Condition="${ContractLineCostMutationCreate.SearchMode} == ViaContractLinesAndThenViaRentableRealEstateContractLines">
				<Message Name="MessageApproved" MessageCode="1837">
					<Parameter	Name="CLCMCount"						Direction="In"		Value="${ContractLineCostMutations.Count}" />
					<Parameter	Name="ContractLineCostMutationCreate"	Direction="In"		Value="${ContractLineCostMutationCreate}" />
					<Parameter	Name="RRECLCMCount"						Direction="In"		Value="${RentableRealEstateContractLineCostMutations.Count}" />
				</Message>
			</When>
		</Choose>

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