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

ActionField1662

Beschrijving: Check if the LOTO-applicable flag can be toggled Custom: Nee

Propertiesbewerken

Property Type Accessor
DomainObject DomainObject Root

XMLbewerken

<Workflow Name="ActionField1662" Version="2025.07.28" WorkflowType="Standard" xmlns="urn:Ultimo.Framework.Workflow-mapping">
	<Security EditLevel="10" ViewLevel="20" UserContentLevel="30" />
	<Description>Check if the LOTO-applicable flag can be toggled</Description>
	<Properties>
		<Property	Name="DomainObject"				Type="DomainObject"					Accessor="Root"		Direction="In"						Comment="Permit/Job that had its LOTO-applicable flag toggled" />

		<Property	Name="Count"					Type="Int32"						Accessor="Internal"										Comment="Number of LOTO requests linked to the permit/job" />
		<Property	Name="ObjectInspectionLines"	Type="List[ObjectInspectionLine]"	Accessor="Internal"										Comment="Checklist options that require LOTO" />
		<Property	Name="ValidStatus"				Type="Boolean"						Accessor="Internal"						Default="False"	Comment="Result of the check on valid permit/job statuses" />
	</Properties>
	<Execution>
		<UserContent Name="Pre" />

		<Comment><![CDATA[	Start by undoing the toggle of the LOTO-applicable flag, just carried out by the user. If all validations pass, the toggle is done once more. ]]></Comment>

		<Transaction>
			<Assign Name="Undo toggle of flag" Property="${DomainObject.LockoutTagoutApplicable}" Value="=!${DomainObject.LockoutTagoutApplicable}" />
		</Transaction>

		<Comment><![CDATA[	The LOTO-applicable flag can only be toggled at certain statuses of the domain object: permits can only have their flag toggled at status Created or Requested.
							Jobs can only have their flag toggled at status Created or Approved. This should be enforced by conditional formatting in the UI, but is also checked for here. ]]></Comment>

		<Choose Name="Check status of domain object (permit or job)">
			<When Name="When this is a permit" Condition="${DomainObject.EntityName} == Permit">
				<Assign Name="Set ValidStatus for permit" Property="${ValidStatus}" Value="=${DomainObject.Status} &amp; (PermitStatus.Created | PermitStatus.Requested) &gt; 0" />
			</When>


			<When Name="When this is a job" Condition="${DomainObject.EntityName} == Job">
				<Assign Name="Set ValidStatus for job" Property="${ValidStatus}" Value="=${DomainObject.Status} &amp; (JobStatus.Created | JobStatus.Approved) &gt; 0" />
			</When>

			<Otherwise Name="Otherwise, not implemented for other domain objects">
				<Stop Name="Stop" Mode="Abort" />
			</Otherwise>
		</Choose>

		<Choose Name="Check if user tried to disable or enable flag">
			<When Name="User tried to disable" Condition="${DomainObject.LockoutTagoutApplicable} == True" Comment="Undone at the start">
				<Validation Name="ValidateLOTOApplicableHasStatusAllowingDisable" Condition="${ValidStatus} == True" MessageCode="3203">
					<Parameter	Name="DomainObject"	Direction="In"		Value="${DomainObject}" />
				</Validation>
			</When>

			<Otherwise Name="Otherwise, user tried to enable">
				<Validation Name="ValidateLOTOApplicableHasStatusAllowingEnable" Condition="${ValidStatus} == True" MessageCode="3180">
					<Parameter	Name="DomainObject"	Direction="In"		Value="${DomainObject}" />
				</Validation>
			</Otherwise>
		</Choose>

		<When Name="When user tried to disable" Condition="${DomainObject.LockoutTagoutApplicable} == True" Comment="Toggle was undone as precaution!">
			<Transaction>
				<GetCount Name="Get count of any requests linked to this DomainObject" Type="ObjectLockoutTagoutRequest" OutputProperty="${Count}">
					<Filters>
						<WhenFilter Condition="${DomainObject.EntityName} == Permit">
							<PropertyFilter	PropertyName="Permit"		Operator="="		PropertyValue="${DomainObject}" />
						</WhenFilter>
						<WhenFilter Condition="${DomainObject.EntityName} == Job">
							<PropertyFilter	PropertyName="Job"			Operator="="		PropertyValue="${DomainObject}" />
						</WhenFilter>
					</Filters>
				</GetCount>
			</Transaction>

			<Validation Name="ValidateDomainObjectDoesNotHaveLinkedRequest(s)" Condition="${Count} == 0" MessageCode="3187">
				<Parameter	Name="Count"		Direction="In"		Value="${Count}" />
				<Parameter	Name="DomainObject"	Direction="In"		Value="${DomainObject}" />
			</Validation>

			<When Name="Additional check for permit" Condition="${DomainObject.EntityName} == Permit">
				<Transaction>
					<GetList Name="Get list of options that require LOTO" Type="ObjectInspectionLine" OutputProperty="${ObjectInspectionLines}" OrderBy="Id" OrderDirection="Ascending">
						<Filters>
							<PropertyFilter	PropertyName="SetsPermitLockoutTagoutApplicable"	Operator="="		PropertyValue="True" />
							<PropertyFilter	PropertyName="Applicable"							Operator="="		PropertyValue="True" />
							<PropertyFilter	PropertyName="Permit"								Operator="="		PropertyValue="${DomainObject}" />
						</Filters>
					</GetList>
				</Transaction>

				<Validation Name="ValidateDomainObjectDoesNotHavePickListOption(s)RequiringLOTO" Condition="${ObjectInspectionLines.Count} == 0" MessageCode="2269">
					<Parameter	Name="ObjectInspectionLines"	Direction="In"		Value="${ObjectInspectionLines}" />
					<Parameter	Name="Permit"					Direction="In"		Value="${DomainObject}" />
				</Validation>
			</When>
		</When>

		<Comment><![CDATA[ Finish by redoing the toggle of the LOTO-applicable flag, because all validations passed. ]]></Comment>

		<Transaction>
			<Assign Name="Redo toggle of flag" Property="${DomainObject.LockoutTagoutApplicable}" Value="=!${DomainObject.LockoutTagoutApplicable}" />
		</Transaction>

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