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

ActionField1657

Beschrijving: Add a LockoutTagoutPlan to/remove a LockoutTagoutPlan from a LockoutTagoutRequest Custom: Nee

Propertiesbewerken

Property Type Accessor
LockoutTagoutRequest LockoutTagoutRequest Root

XMLbewerken

<Workflow Name="ActionField1657" Version="2025.07.28" WorkflowType="Standard" xmlns="urn:Ultimo.Framework.Workflow-mapping">
	<Security EditLevel="10" ViewLevel="20" UserContentLevel="30" />
	<Description>Add a LockoutTagoutPlan to/remove a LockoutTagoutPlan from a LockoutTagoutRequest</Description>
	<Properties>
		<Property	Name="LockoutTagoutRequest"					Type="LockoutTagoutRequest"			Accessor="Root"		Direction="In"						Comment="LOTO request to add a LOTO plan to/remove a LOTO plan from" />

		<Property	Name="AnswerToQuestion"						Type="RequestResult"				Accessor="Internal"						Default="Yes" />
		<Property	Name="CountOfExistingLOTOLines"				Type="Int32"						Accessor="Internal"										Comment="Count of LOTO lines currently linked to LOTO request" />
		<Property	Name="CountOfMarkersNotRelatedToLOTOPlan"	Type="Int32"						Accessor="Internal"										Comment="Count of markers not related to the LOTO plan" />
		<Property	Name="LockoutTagoutPlan"					Type="LockoutTagoutPlan"			Accessor="Internal"										Comment="LOTO plan selected to add" />
		<Property	Name="LockoutTagoutPlanLines"				Type="List[LockoutTagoutPlanLine]"	Accessor="Internal"										Comment="Lines associated with the LOTO plan" />
		<Property	Name="PlanPnIDs"							Type="List[PlotPlan]"				Accessor="Internal"										Comment="PnIDs (plot plans) linked to the LOTO Plan to be removed from the LOTO request" />
	</Properties>
	<Execution>
		<UserContent Name="Pre" />

		<Validation Name="ValidateLockoutTagoutRequestHasStatusRequested" Condition="${LockoutTagoutRequest.Status} == LockoutTagoutRequestStatus.Requested" MessageCode="3181">
			<Parameter	Name="LockoutTagoutRequest"	Direction="In"		Value="${LockoutTagoutRequest}" />
		</Validation>

		<Choose Name="Check if LOTO plan should be connected or detached">
			<When Name="Is there currently a LOTO plan on the LOTO request: then detach it" Condition="${LockoutTagoutRequest.LockoutTagoutPlan} != Empty">
				<Question Name="Detach this LOTO plan?" Type="YesNo" MessageCode="2300" OutputProperty="${AnswerToQuestion}">
					<Parameter	Name="LockoutTagoutPlan"	Direction="In"		Value="${LockoutTagoutRequest.LockoutTagoutPlan}" />
				</Question>

				<When Name="Detach if answer is positive" Condition="${AnswerToQuestion} == Yes">
					<Transaction>
						<Comment><![CDATA[ remove related plot plans ]]></Comment>

						<GetList Name="Get plot plans related to the LOTO plan" Type="PlotPlan" OutputProperty="${PlanPnIDs}" OrderBy="Id" OrderDirection="Ascending">
							<Joins>
								<Join	Name="LockoutTagoutPlan"	Alias="ltp"	Type="InnerJoin" />
								<Join	Name="LockoutTagoutRequest"	Alias="ltr"	Type="InnerJoin" />
							</Joins>
							<Filters>
								<PropertyFilter	PropertyName="ltp.Id"	Operator="="		PropertyValue="${LockoutTagoutRequest.LockoutTagoutPlan.Id}" />
								<PropertyFilter	PropertyName="ltr.Id"	Operator="="		PropertyValue="${LockoutTagoutRequest.Id}" />
							</Filters>
						</GetList>

						<ForEach Name="Remove these if there are no markers not related to the plot plan" In="${PlanPnIDs}" As="PlotPlanSource">
							<Assign Name="Remove reference to LOTO plan" Property="${PlotPlanSource.LockoutTagoutPlan}" Value="Empty" />
						</ForEach>

						<WorkflowCall Name="Remove lines attached to LOTO request that are related to the LOTO plan from which we are detaching" WorkflowName="LockoutTagoutRequest_DeleteLockoutTagoutRequestLinesAssociatedWithPlan">
							<Parameter	Name="LockoutTagoutRequest"	Direction="In"		Value="${LockoutTagoutRequest}" />
						</WorkflowCall>

						<ForEach Name="Remove the plot plans without any markers left" In="${PlanPnIDs}" As="PlotPlanSource">
							<GetCount Name="Are there any markers left for this plot plan: if not, remove the plot plan" Type="PlotPlanMarker" OutputProperty="${CountOfMarkersNotRelatedToLOTOPlan}">
								<Filters>
									<PropertyFilter	PropertyName="PlotPlan"	Operator="="		PropertyValue="${PlotPlanSource}" />
								</Filters>
							</GetCount>

							<When Name="If count == 0, remove the PnID" Condition="${CountOfMarkersNotRelatedToLOTOPlan} == 0">
								<DeleteObject Name="Remove it" DomainObject="${PlotPlanSource}" />
							</When>
						</ForEach>

						<Assign Name="Reset LOTO plan on LOTO request" Property="${LockoutTagoutRequest.LockoutTagoutPlan}" Value="Empty" />
					</Transaction>
				</When>
			</When>

			<Otherwise Name="No LOTO plan yet, connect it, and add lines">
				<Transaction>
					<GetCount Name="Get count of existing LOTO request lines" Type="LockoutTagoutRequestLine" OutputProperty="${CountOfExistingLOTOLines}">
						<Filters>
							<PropertyFilter	PropertyName="LockoutTagoutRequest"	Operator="="		PropertyValue="${LockoutTagoutRequest}" />
						</Filters>
					</GetCount>
				</Transaction>

				<Validation Name="ValidateNoLOTORequestLinesYet" Condition="${CountOfExistingLOTOLines} == 0" MessageCode="3224">
					<Parameter	Name="Count"				Direction="In"		Value="${CountOfExistingLOTOLines}" />
					<Parameter	Name="LockoutTagoutRequest"	Direction="In"		Value="${LockoutTagoutRequest}" />
				</Validation>

				<SystemDialog Name="Select a LockoutTagoutPlan to add" DialogName="SelectDomainObject">
					<Parameter	Name="IsSystem"						Direction="In"		Value="True" />
					<Parameter	Name="SelectionListConfiguration"	Direction="In"		Value="Default" />
					<Parameter	Name="SqlWhereClause"				Direction="In"		Value="LtpRecStatus = 2" />
					<Parameter	Name="TableName"					Direction="In"		Value="LockoutTagoutPlan" />
					<Parameter	Name="DomainObject"					Direction="Out"									OutputProperty="${LockoutTagoutPlan}" />
				</SystemDialog>

				<Transaction>
					<GetList Name="Get lines from LOTO plan" Type="LockoutTagoutPlanLine" OutputProperty="${LockoutTagoutPlanLines}" OrderBy="Id" OrderDirection="Ascending">
						<Filters>
							<PropertyFilter	PropertyName="Id.LockoutTagoutPlan"	Operator="="		PropertyValue="${LockoutTagoutPlan}" />
						</Filters>
					</GetList>

					<WorkflowCall Name="Add lines to LOTO request based on LOTO plan" WorkflowName="LockoutTagoutRequest_AddLinesBasedOnLockoutTagoutPlan">
						<Parameter	Name="LockoutTagoutPlan"		Direction="In"		Value="${LockoutTagoutPlan}" />
						<Parameter	Name="LockoutTagoutPlanLines"	Direction="In"		Value="${LockoutTagoutPlanLines}" />
						<Parameter	Name="LockoutTagoutRequest"		Direction="In"		Value="${LockoutTagoutRequest}" />
					</WorkflowCall>

					<Assign Name="Add LOTO plan to LOTO request" Property="${LockoutTagoutRequest.LockoutTagoutPlan}" Value="${LockoutTagoutPlan}" />
				</Transaction>
			</Otherwise>
		</Choose>

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