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

ActionField1279

Beschrijving: Copy Budget to a new year for this CostCenter. Custom: Nee

Propertiesbewerken

Property Type Accessor
CostCenter CostCenter Root
CopyDeviations Boolean Optional
IncludeMutations Boolean Optional

XMLbewerken

<Workflow Name="ActionField1279" Version="2025.07.28" WorkflowType="Standard" xmlns="urn:Ultimo.Framework.Workflow-mapping">
	<Security EditLevel="10" ViewLevel="20" UserContentLevel="30" />
	<Description>Copy Budget to a new year for this CostCenter.</Description>
	<Properties>
		<Property	Name="CostCenter"						Type="CostCenter"			Accessor="Root"		Direction="In" />

		<Property	Name="CopyDeviations"					Type="Boolean"				Accessor="Optional"	Direction="In"		Default="True"															Comment="Sets the default value for the checkbox CopyDeviations in dialog. True: the deviations will be copied. False: all months are balanced (the rounding occurs in the last month of the quarter)" />
		<Property	Name="IncludeMutations"					Type="Boolean"				Accessor="Optional"	Direction="In"		Default="True"															Comment="Sets the default value for the checkbox IncludeMutations in dialog. True: the budget mutation will be included. False: original budget is used" />

		<Property	Name="BudgetPeriods"					Type="List[BudgetPeriod]"	Accessor="Internal" />
		<Property	Name="CostTypeBudgetPeriods"			Type="List[BudgetPeriod]"	Accessor="Internal" />
		<Property	Name="DomainGlobals"					Type="DomainGlobals"		Accessor="Internal"						Default="#{UltimoSettings.Id}" />
		<Property	Name="FromBudgetPeriod"					Type="BudgetPeriod"			Accessor="Internal" />
		<Property	Name="ToYear"							Type="Int32"				Accessor="Internal" />
		<Property	Name="UnapprovedBudgetPeriodMutations"	Type="Int64"				Accessor="Internal" />
		<Property	Name="Years"							Type="List[Int32]"			Accessor="Internal"						Default="=#range(#getyear(${DomainGlobals.StartDateFinanceYear}) , 7)" />
	</Properties>
	<Execution>
		<UserContent Name="Pre" />

		<Transaction>
			<GetList Name="BudgetPeriods" Type="BudgetPeriod" OutputProperty="${BudgetPeriods}" OrderBy="Year" OrderDirection="Descending" Top="5">
				<Filters>
					<PropertyFilter	PropertyName="Context"		Operator="="		PropertyValue="BudgetPeriodContext.Year" />
					<PropertyFilter	PropertyName="Status"		Operator="="		PropertyValue="BudgetPeriodStatus.Approved" />
					<PropertyFilter	PropertyName="CostCenter"	Operator="="		PropertyValue="${CostCenter}" />
				</Filters>
			</GetList>

			<When Name="BudgetPeriods Found" Condition="${BudgetPeriods.Count} &gt; 0">
				<ForEach Name="Year" In="${Years}" As="Year" Condition="${Year} &lt;= ${BudgetPeriods[0].Year} ">
					<RemoveFromList Name="Remove not allowed year (validation 2744)" List="${Years}" Item="${Year}" />
				</ForEach>
			</When>
		</Transaction>

		<Dialog Name="SelectApprovedBudgetPeriodAndSelectYear" TitleCode="COPYBUDGETPERIOD" LabelWidth="275">
			<Container Border="True">
				<ComboBox Name="FromBudgetPeriod" Width="200" OutputProperty="${FromBudgetPeriod}" ColumnName="BdgpId" Required="True" LabelCode="FROMYEAR" ItemDescription="${Item.Year}" Items="${BudgetPeriods}" />

				<ComboBox Name="ToYear" Width="200" Value="${ToYear}" OutputProperty="${ToYear}" Required="True" LabelCode="TOYEAR" Items="${Years}" />

				<CheckBox Name="CopyDeviations" Value="${CopyDeviations}" OutputProperty="${CopyDeviations}" LabelCode="COPYDEVIATIONS" />

				<CheckBox Name="IncludeMutations" Value="${IncludeMutations}" OutputProperty="${IncludeMutations}" LabelCode="COPYMUTATIONS" />
			</Container>
		</Dialog>

		<Validation Name="Check previous year" Condition="${ToYear} &gt; ${FromBudgetPeriod.Year}" MessageCode="2744">
			<Parameter	Name="BudgetPeriod"	Direction="In"		Value="${FromBudgetPeriod}" />
		</Validation>

		<When Name="Include Mutations" Condition="${IncludeMutations} == True">
			<Transaction>
				<GetCount Name="Get unapproved budgetperiod mutations for the selected budgetperiod" Type="BudgetPeriod" OutputProperty="${UnapprovedBudgetPeriodMutations}">
					<Filters>
						<PropertyFilter	PropertyName="Context"								Operator="="		PropertyValue="BudgetPeriodContext.YearMutation" />
						<InFilter PropertyName="Status" Values="BudgetPeriodStatus.Created,BudgetPeriodStatus.Requested" />
						<PropertyFilter	PropertyName="CostCenter"							Operator="="		PropertyValue="${CostCenter}" />
						<PropertyFilter	PropertyName="PartOfBudgetPeriodForBudgetMutation"	Operator="="		PropertyValue="${FromBudgetPeriod}" />
					</Filters>
				</GetCount>
			</Transaction>

			<When Name="UnapprovedBudgetPeriodMutations are found" Condition="${UnapprovedBudgetPeriodMutations} &gt; 0">
				<ContinuationQuestion Name="AreYouSure" MessageCode="2745" Default="No">
					<Parameter	Name="BudgetPeriod"	Direction="In"		Value="${FromBudgetPeriod}" />
				</ContinuationQuestion>
			</When>
		</When>

		<Transaction>
			<Choose Name="Check SplitForCostType">
				<When Name="True" Condition="${FromBudgetPeriod.SplitForCostType} == True">
					<GetList Name="Get All CostType-BudgetPeriods" Type="BudgetPeriod" OutputProperty="${CostTypeBudgetPeriods}" OrderBy="Id" OrderDirection="Ascending">
						<Filters>
							<PropertyFilter	PropertyName="PartOfBudgetPeriodForCostType.Id"	Operator="="		PropertyValue="${FromBudgetPeriod}" />
							<PropertyFilter	PropertyName="Context"							Operator="="		PropertyValue="BudgetPeriodContext.CostTypeYear" />
						</Filters>
					</GetList>

					<ForEach Name="Loop CostTypeBudgetPeriods" In="${CostTypeBudgetPeriods}" As="CostTypeBudgetPeriod">
						<WorkflowCall Name="BudgetPeriod_CopyPeriod" WorkflowName="BudgetPeriod_CopyPeriod">
							<Parameter	Name="BudgetPeriod"		Direction="In"		Value="${CostTypeBudgetPeriod}" />
							<Parameter	Name="CopyDeviations"	Direction="In"		Value="${CopyDeviations}" />
							<Parameter	Name="IncludeMutations"	Direction="In"		Value="${IncludeMutations}" />
							<Parameter	Name="Year"				Direction="In"		Value="${ToYear}" />
						</WorkflowCall>
					</ForEach>
				</When>

				<Otherwise Name="False">
					<WorkflowCall Name="BudgetPeriod_CopyPeriod" WorkflowName="BudgetPeriod_CopyPeriod">
						<Parameter	Name="BudgetPeriod"		Direction="In"		Value="${FromBudgetPeriod}" />
						<Parameter	Name="CopyDeviations"	Direction="In"		Value="${CopyDeviations}" />
						<Parameter	Name="IncludeMutations"	Direction="In"		Value="${IncludeMutations}" />
						<Parameter	Name="Year"				Direction="In"		Value="${ToYear}" />
					</WorkflowCall>
				</Otherwise>
			</Choose>
		</Transaction>

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