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

ActionField1572

Beschrijving: Approve ExchangeRate and check the new Rate. Custom: Nee

Propertiesbewerken

Property Type Accessor
ExchangeRate ExchangeRate Root
Percentage Int16 Optional

XMLbewerken

<Workflow Name="ActionField1572" Version="2025.07.28" WorkflowType="Standard" xmlns="urn:Ultimo.Framework.Workflow-mapping">
	<Security EditLevel="10" ViewLevel="20" UserContentLevel="30" />
	<Description>Approve ExchangeRate and check the new Rate.</Description>
	<Properties>
		<Property	Name="ExchangeRate"		Type="ExchangeRate"			Accessor="Root"		Direction="In" />

		<Property	Name="Percentage"		Type="Int16"				Accessor="Optional"	Direction="In"		Default="5"		Comment="The difference between the new (Rate*ConversionFactor) and the last (Rate*ConversionFactor) may not be greater then this Percentage" />

		<Property	Name="ConversionFactor"	Type="Int16"				Accessor="Internal"						Default="0" />
		<Property	Name="ExchangeRates"	Type="List[ExchangeRate]"	Accessor="Internal"						Default="Empty" />
		<Property	Name="NewValue"			Type="Decimal"				Accessor="Internal"						Default="0" />
		<Property	Name="OldValue"			Type="Decimal"				Accessor="Internal"						Default="0" />
		<Property	Name="PercOldValue"		Type="Decimal"				Accessor="Internal"						Default="0" />
		<Property	Name="Rate"				Type="Decimal"				Accessor="Internal"						Default="0" />
	</Properties>
	<Execution>
		<UserContent Name="Pre" />

		<Choose Name="Change status to Concept/Approved">
			<When Name="Status is Approved?" Condition="${ExchangeRate.Status} == ExchangeRateStatus.Approved">
				<Transaction>
					<ChangeStatus Name="Change ExchangeRate Status To Concept" DomainObject="${ExchangeRate}" NewStatus="ExchangeRateStatus.Concept" />
				</Transaction>
			</When>

			<Otherwise Name="Status is Concept">
				<Transaction>
					<GetList Name="Get Last Approved ExchangeRate" Type="ExchangeRate" OutputProperty="${ExchangeRates}" OrderBy="Date" OrderDirection="Descending" Top="1">
						<Filters>
							<CombinedFilter FilterOperator="And">
								<PropertyFilter	PropertyName="Id.ExchangeCurrency.Id.BaseCurrency"		Operator="="		PropertyValue="${ExchangeRate.Id.ExchangeCurrency.Id.BaseCurrency}" />
								<PropertyFilter	PropertyName="Id.ExchangeCurrency.Id.CounterCurrency"	Operator="="		PropertyValue="${ExchangeRate.Id.ExchangeCurrency.Id.CounterCurrency}" />
								<PropertyFilter	PropertyName="Status"									Operator="="		PropertyValue="ExchangeRateStatus.Approved" />
								<PropertyFilter	PropertyName="Date"										Operator="&lt;="	PropertyValue="${ExchangeRate.Date}" />
							</CombinedFilter>
						</Filters>
					</GetList>
				</Transaction>

				<When Name="When there is a ExchangeRate found" Condition="${ExchangeRates.Count} &gt; 0">
					<Assign Name="Set ConversionFactor" Property="${ConversionFactor}" Value="=#getpropertyvalue(#elementat(${ExchangeRates}, 0), 'ConversionFactor')" />
					<Assign Name="Set Rate" Property="${Rate}" Value="=#getpropertyvalue(#elementat(${ExchangeRates}, 0), 'Rate')" />
					<Assign Name="Set NewValue" Property="${NewValue}" Value="=${ExchangeRate.ConversionFactor} * ${ExchangeRate.Rate}" />
					<Assign Name="Set OldValue" Property="${OldValue}" Value="=${ConversionFactor} * ${Rate}" />
					<Assign Name="Calculate 5% of OldValue" Property="${PercOldValue}" Value="=(${OldValue}/100) * ${Percentage}" />

					<When Name="When Difference is too great" Condition="${NewValue} &gt; (${OldValue}+${PercOldValue}) || ${NewValue} &lt; (${OldValue}-${PercOldValue})">
						<ContinuationQuestion Name="Continue with Approving ExchangeRate" MessageCode="2914">
							<Parameter	Name="Percentage"	Direction="In"		Value="${Percentage}" />
						</ContinuationQuestion>
					</When>
				</When>

				<Transaction>
					<ChangeStatus Name="Change ExchangeRate Status To Approved" DomainObject="${ExchangeRate}" NewStatus="ExchangeRateStatus.Approved" />
				</Transaction>
			</Otherwise>
		</Choose>

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