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

ActionField1044

Beschrijving: Sets the RiskClass based on RiskScore for this DomainObject. Synchronizes RiskScore and RiskClass with LongTermAsset. Custom: Nee

Propertiesbewerken

Property Type Accessor
DomainObject DomainObject Root
RiskContext Context Optional

XMLbewerken

<Workflow Name="ActionField1044" Version="2025.07.28" WorkflowType="Standard" xmlns="urn:Ultimo.Framework.Workflow-mapping">
	<Security EditLevel="10" ViewLevel="20" UserContentLevel="30" />
	<Description>Sets the RiskClass based on RiskScore for this DomainObject. Synchronizes RiskScore and RiskClass with LongTermAsset.</Description>
	<Properties>
		<Property	Name="DomainObject"			Type="DomainObject"			Accessor="Root"		Direction="In" />

		<Property	Name="RiskContext"			Type="Context"				Accessor="Optional"	Direction="In"		Default="RiskClassContext.HealthSafetyEnvironment"	Comment="Only search in RiskClasses with this context" />

		<Property	Name="LongTermAssets"		Type="List[LongTermAsset]"	Accessor="Internal" />
		<Property	Name="Max"					Type="Decimal"				Accessor="Internal" />
		<Property	Name="Min"					Type="Decimal"				Accessor="Internal" />
		<Property	Name="RiskClass"			Type="RiskClass"			Accessor="Internal" />
		<Property	Name="UpdateLongTermAsset"	Type="RequestResult"		Accessor="Internal" />
	</Properties>
	<Execution>
		<UserContent Name="Pre" />

		<Choose Name="RiskScore is NULL/zero or has meaningful value?">
			<When Name="RiskScore is NULL/zero" Condition="${DomainObject.RiskScore} == Empty || ${DomainObject.RiskScore} == 0">
				<Transaction>
					<Assign Name="Clear RiskClass from DomainObject" Property="${DomainObject.RiskClass}" Value="Empty" />
				</Transaction>
			</When>

			<Otherwise Name="RiskScore has meaningful value so try to obtain RiskClass">
				<WorkflowCall Name="RiskClass_GetRiskClassForScore" WorkflowName="RiskClass_GetRiskClassForScore">
					<Parameter	Name="RiskContext"	Direction="In"		Value="${RiskContext}" />
					<Parameter	Name="RiskScore"	Direction="In"		Value="${DomainObject.RiskScore}" />
					<Parameter	Name="RiskClass"	Direction="Out"											OutputProperty="${RiskClass}" />
				</WorkflowCall>

				<Choose Name="Check if RiskClass is returned (e.g. RiskScore is within valid ranges)">
					<When Name="When a RiskClass is returned" Condition="${RiskClass} != Empty">
						<Transaction>
							<Assign Name="Assign new RiskClass to DomainObject" Property="${DomainObject.RiskClass}" Value="${RiskClass}" />
						</Transaction>
					</When>

					<Otherwise Name="Otherwise no RiskClass is returned">
						<WorkflowCall Name="RiskClass_GetMinAndMaxForRiskClassContext" WorkflowName="RiskClass_GetMinAndMaxForRiskClassContext">
							<Parameter	Name="RiskContext"	Direction="In"		Value="${RiskContext}" />
							<Parameter	Name="Max"			Direction="Out"								OutputProperty="${Max}" />
							<Parameter	Name="Min"			Direction="Out"								OutputProperty="${Min}" />
						</WorkflowCall>

						<Message Name="MessageRiskScoreOutOfRange" MessageCode="2029">
							<Parameter	Name="Max"			Direction="In"		Value="=#formatnumber(${Max}, 2)" />
							<Parameter	Name="Min"			Direction="In"		Value="=#formatnumber(${Min}, 2)" />
							<Parameter	Name="RiskContext"	Direction="In"		Value="${RiskContext}" />
						</Message>

						<Transaction>
							<Assign Name="Clear RiskScore" Property="${DomainObject.RiskScore}" Value="0" Comment="We cannot set the original value because it has been cleared before this WF is called, so we will set it to 0" />
							<Assign Name="Clear RiskClass" Property="${DomainObject.RiskClass}" Value="Empty" Comment="we cannot reset RiskScore/RiskClass to their old values" />
						</Transaction>

						<Stop Name="Stop" Mode="EndCurrent" />
					</Otherwise>
				</Choose>
			</Otherwise>
		</Choose>

		<When Name="DomainObject is a piece of Equipment or a Process Function" Condition="${DomainObject.EntityName} == Equipment || ${DomainObject.EntityName} == ProcessFunction">
			<Transaction>
				<GetList Name="Get LTA" Type="LongTermAsset" OutputProperty="${LongTermAssets}" OrderBy="Id" OrderDirection="Ascending" Comment="There should be only one!">
					<Filters>
						<WhenFilter Condition="${DomainObject.EntityName} == Equipment">
							<PropertyFilter	PropertyName="Equipment"	Operator="="		PropertyValue="${DomainObject}" />
						</WhenFilter>
						<WhenFilter Condition="${DomainObject.EntityName} == ProcessFunction">
							<PropertyFilter	PropertyName="ProcessFunction"	Operator="="		PropertyValue="${DomainObject}" />
						</WhenFilter>
					</Filters>
				</GetList>
			</Transaction>

			<ForEach Name="LTA" In="${LongTermAssets}" As="LongTermAsset">
				<Choose Name="Check if RiskScore and RiskClass currently set or not">
					<When Name="When currently set" Condition="${LongTermAsset.RiskScore} != 0 || ${LongTermAsset.RiskClass} != Empty">
						<Question Name="AskIfLongTermAssetShouldBeUpdated" Type="YesNo" MessageCode="2972" Default="Yes" OutputProperty="${UpdateLongTermAsset}">
							<Parameter	Name="LongTermAsset"	Direction="In"		Value="${LongTermAsset}" />
						</Question>
					</When>

					<Otherwise Name="Otherwise, not currently set">
						<Question Name="AskIfLongTermAssetShouldBeSet" Type="YesNo" MessageCode="2973" Default="Yes" OutputProperty="${UpdateLongTermAsset}">
							<Parameter	Name="LongTermAsset"	Direction="In"		Value="${LongTermAsset}" />
						</Question>
					</Otherwise>
				</Choose>

				<When Name="When LongTermAsset should be updated" Condition="${UpdateLongTermAsset} == Yes">
					<WorkflowCall Name="DomainObject_SynchronizeRiskWithLongTermAsset" WorkflowName="DomainObject_SynchronizeRiskWithLongTermAsset">
						<Parameter	Name="DomainObject"	Direction="In"		Value="${DomainObject}" />
					</WorkflowCall>
				</When>
			</ForEach>
		</When>

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