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

ActionField321

Beschrijving: Create Equipments for EquipmentType. Custom: Nee

Propertiesbewerken

Property Type Accessor
DomainObject DomainObject Root
CopyFeatures Boolean Optional
CopySpareParts Boolean Optional
DefaultValueIndividualPM Boolean Optional
EquipmentContext Context Optional
GetNumberOfEquipments Boolean Optional
MaintenanceClassificationContext Context Optional
PmWorkOrderContext Context Optional

XMLbewerken

<Workflow Name="ActionField321" Version="2025.07.28" WorkflowType="Standard" xmlns="urn:Ultimo.Framework.Workflow-mapping">
	<Security EditLevel="10" ViewLevel="20" UserContentLevel="30" />
	<Description>Create Equipments for EquipmentType.</Description>
	<Properties>
		<Property	Name="DomainObject"							Type="DomainObject"							Accessor="Root"		Direction="In" />

		<Property	Name="CopyFeatures"							Type="Boolean"								Accessor="Optional"	Direction="In"		Default="True"														Comment="Copy Features from EquipmentType to Equipment" />
		<Property	Name="CopySpareParts"						Type="Boolean"								Accessor="Optional"	Direction="In"		Default="True"														Comment="Copy SpareParts from EquipmentType to Equipment" />
		<Property	Name="DefaultValueIndividualPM"				Type="Boolean"								Accessor="Optional"	Direction="In"		Default="False"														Comment="Set default value for checkbox IndividualPM in dialog" />
		<Property	Name="EquipmentContext"						Type="Context"								Accessor="Optional"	Direction="In"		Default="EquipmentContext.Instrument"								Comment="Create Equipment with this Context" />
		<Property	Name="GetNumberOfEquipments"				Type="Boolean"								Accessor="Optional"	Direction="In"		Default="True"														Comment="Set to True to enable changing the amount of records to create in the dialog" />
		<Property	Name="MaintenanceClassificationContext"		Type="Context"								Accessor="Optional"	Direction="In"		Default="MaintenanceClassificationContext.MT"						Comment="Only select MaintenanceClassification with this context" />
		<Property	Name="PmWorkOrderContext"					Type="Context"								Accessor="Optional"	Direction="In"		Default="PmWorkOrderContext.Instrument"								Comment="Create PmWorkOrder with this Context" />

		<Property	Name="AvailableProductDossiers"				Type="List[ProductDossier]"					Accessor="Internal" />
		<Property	Name="CreatedEquipments"					Type="List[Equipment]"						Accessor="Internal" />
		<Property	Name="EquipmentType"						Type="EquipmentType"						Accessor="Internal" />
		<Property	Name="EquipmentTypeProductDossiers"			Type="List[EquipmentTypeProductDossier]"	Accessor="Internal" />
		<Property	Name="InvalidStatuses"						Type="List[Status]"							Accessor="Internal"						Default="ProductDossierStatus.Closed,ProductDossierStatus.Canceled" />
		<Property	Name="MaintenanceClassifications"			Type="List[MaintenanceClassification]"		Accessor="Internal" />
		<Property	Name="NumberOfEquipments"					Type="Int32"								Accessor="Internal"						Default="1" />
		<Property	Name="ProductDossierContext"				Type="Context?"								Accessor="Internal"																							Comment="Also used to determine whether ProductDossier should be shown in dialog" />
		<Property	Name="SelectedIndividualPM"					Type="Boolean"								Accessor="Internal"						Default="${DefaultValueIndividualPM}" />
		<Property	Name="SelectedInstallDate"					Type="Date?"								Accessor="Internal" />
		<Property	Name="SelectedMaintenanceClassification"	Type="MaintenanceClassification"			Accessor="Internal" />
		<Property	Name="SelectedProductDossier"				Type="ProductDossier"						Accessor="Internal" />
	</Properties>
	<Execution>
		<UserContent Name="Pre" />

		<Choose Name="Check DomainObject">
			<When Name="When DomainObject is EquipmentTypeProductDossier" Condition="${DomainObject.EntityName} == EquipmentTypeProductDossier">
				<Assign Name="Set EquipmentType" Property="${EquipmentType}" Value="${DomainObject.Id.EquipmentType}" />
				<Assign Name="Prefil SelectedProductDossier from link record for dialog" Property="${SelectedProductDossier}" Value="${DomainObject.Id.ProductDossier}" />
				<Assign Name="Set ProductDossierContext" Property="${ProductDossierContext}" Value="${SelectedProductDossier.Context}" />

				<AddToList Name="Add ProductDossier to list 1" List="${AvailableProductDossiers}" Item="${SelectedProductDossier}" />
			</When>

			<Otherwise Name="Otherwise DomainObject is EquipmentType">
				<Assign Name="Set EquipmentType" Property="${EquipmentType}" Value="${DomainObject}" />

				<Transaction>
					<GetList Name="Get EquipmentTypeProductDossier by EquipmentType" Type="EquipmentTypeProductDossier" OutputProperty="${EquipmentTypeProductDossiers}" OrderBy="Id" OrderDirection="Ascending">
						<Joins>
							<Join	Name="Id.ProductDossier"	Alias="productDossier"	Type="InnerJoin" />
						</Joins>
						<Filters>
							<PropertyFilter	PropertyName="Id.EquipmentType"	Operator="="		PropertyValue="${EquipmentType}" />
							<NotFilter>
								<InFilter PropertyName="productDossier.Status" Values="${InvalidStatuses}" />
							</NotFilter>
						</Filters>
					</GetList>
				</Transaction>

				<When Name="When link(s) between EquipmentType and ProductDossier found" Condition="${EquipmentTypeProductDossiers.Count} != 0">
					<Comment><![CDATA[ Because one or more EquipmentTypeProductDossiers are found, this context is set which will also enable ProductDossier in dialog! ]]></Comment>

					<Assign Name="Set ProductDossierContext" Property="${ProductDossierContext}" Value="${EquipmentTypeProductDossiers[0].Id.ProductDossier.Context}" />

					<Choose Name="Check if one or more links found">
						<When Name="When exactly one link found" Condition="${EquipmentTypeProductDossiers.Count} == 1">
							<Assign Name="Prefil SelectedProductDossier for dialog" Property="${SelectedProductDossier}" Value="${EquipmentTypeProductDossiers[0].Id.ProductDossier}" />

							<AddToList Name="Add ProductDossier to list 2" List="${AvailableProductDossiers}" Item="${SelectedProductDossier}" />
						</When>

						<Otherwise Name="Otherwise, more than one link found">
							<ForEach Name="For each link" In="${EquipmentTypeProductDossiers}" As="EquipmentTypeProductDossier">
								<AddToList Name="Add ProductDossier to list 3" List="${AvailableProductDossiers}" Item="${EquipmentTypeProductDossier.Id.ProductDossier}" />
							</ForEach>
						</Otherwise>
					</Choose>
				</When>
			</Otherwise>
		</Choose>

		<Transaction>
			<GetList Name="Get active MaintenanceClassifications for this EquipmentType" Type="MaintenanceClassification" OutputProperty="${MaintenanceClassifications}" OrderBy="Id" OrderDirection="Ascending">
				<Filters>
					<PropertyFilter	PropertyName="EquipmentType"	Operator="="		PropertyValue="${EquipmentType}" />
					<PropertyFilter	PropertyName="Status"			Operator="="		PropertyValue="MaintenanceClassificationStatus.Approved" />
				</Filters>
			</GetList>
		</Transaction>

		<When Name="When just a single MaintenanceClassification was found" Condition="${MaintenanceClassifications.Count} == 1">
			<Assign Name="Prefil SelectedMaintenanceClassification for dialog" Property="${SelectedMaintenanceClassification}" Value="${MaintenanceClassifications[0]}" />
		</When>

		<Dialog Name="Equipment_CreateFromEquipmentType" TitleCode="CREATEEQUIPMENT">
			<Container Border="True">
				<ComboBox Name="ProductDossier" Width="350" Visible="=${ProductDossierContext} != Empty" Value="${SelectedProductDossier}" OutputProperty="${SelectedProductDossier}" Required="False" ReadOnly="=${DomainObject.EntityName} == EquipmentTypeProductDossier" LabelCode="PRODUCTDOSSIERCTX" ItemDescription="${Item.Id} - ${Item.Description}" Items="${AvailableProductDossiers}" />

				<Number Name="NumberOfEquipments" Width="85" Visible="=${GetNumberOfEquipments} == True" Value="${NumberOfEquipments}" OutputProperty="${NumberOfEquipments}" LabelCode="NUMBEROFEQMS" MinValue="1" MaxValue="999" DecimalPrecision="0" />

				<ComboBox Name="MaintenanceClassification" Width="350" Value="${SelectedMaintenanceClassification}" OutputProperty="${SelectedMaintenanceClassification}" Required="False" LabelCode="MAINTENANCECLASSIFICATION" ItemDescription="${Item.Id} - ${Item.Description}" OrderDirection="Ascending" OrderBy="Description">
					<Filters>
						<PropertyFilter	PropertyName="EquipmentType"	Operator="="		PropertyValue="${EquipmentType}" />
						<PropertyFilter	PropertyName="Status"			Operator="="		PropertyValue="MaintenanceClassificationStatus.Approved" />
					</Filters>
				</ComboBox>

				<CheckBox Name="IndividualPM" Value="${SelectedIndividualPM}" OutputProperty="${SelectedIndividualPM}" LabelCode="INDIVIDUALPM" />

				<Date Name="InstallDate" Value="Empty" OutputProperty="${SelectedInstallDate}" Required="=${SelectedIndividualPM} == False" LabelCode="INSTALLATION_DATE" />
			</Container>
		</Dialog>

		<WorkflowCall Name="Create equipments for EquipmentType" WorkflowName="EquipmentType_CreateEquipment">
			<Parameter	Name="CopyFeatures"					Direction="In"		Value="${CopyFeatures}" />
			<Parameter	Name="CopySpareParts"				Direction="In"		Value="${CopySpareParts}" />
			<Parameter	Name="EquipmentContext"				Direction="In"		Value="${EquipmentContext}" />
			<Parameter	Name="EquipmentType"				Direction="In"		Value="${EquipmentType}" />
			<Parameter	Name="IndividualPM"					Direction="In"		Value="${SelectedIndividualPM}" />
			<Parameter	Name="InstallDate"					Direction="In"		Value="${SelectedInstallDate}" />
			<Parameter	Name="MaintenanceClassification"	Direction="In"		Value="${SelectedMaintenanceClassification}" />
			<Parameter	Name="NumberOfEquipments"			Direction="In"		Value="${NumberOfEquipments}" />
			<Parameter	Name="ProductDossier"				Direction="In"		Value="${SelectedProductDossier}" />
			<Parameter	Name="CreatedEquipments"			Direction="Out"														OutputProperty="${CreatedEquipments}" />
		</WorkflowCall>

		<When Name="When MaintenanceClassification was selected" Condition="${SelectedMaintenanceClassification} != Empty">
			<ForEach Name="For each equipment in list of created equipments" In="${CreatedEquipments}" As="Equipment">
				<WorkflowCall Name="ChangeMaintenanceClassification" WorkflowName="Equipment_ChangeMaintenanceClassification">
					<Parameter	Name="AutoAnswerMaintenanceClassification"					Direction="In"		Value="${SelectedMaintenanceClassification}" />
					<Parameter	Name="AutoAnswerQuestionChangeMaintenanceClassification"	Direction="In"		Value="Yes" />
					<Parameter	Name="Equipment"											Direction="In"		Value="${Equipment}" />
					<Parameter	Name="MaintenanceClassificationContexts"					Direction="In"		Value="${MaintenanceClassificationContext}" />
					<Parameter	Name="PmWorkOrderContext"									Direction="In"		Value="${PmWorkOrderContext}" />
					<Parameter	Name="ShowResultMessage"									Direction="In"		Value="False"									Comment="Suppress message about classification change" />
				</WorkflowCall>
			</ForEach>
		</When>

		<Message Name="MessageWithNumberOfEquipmentsCreated" MessageCode="2610">
			<Parameter	Name="EquipmentContext"		Direction="In"		Value="${EquipmentContext}" />
			<Parameter	Name="NumberOfEquipments"	Direction="In"		Value="${NumberOfEquipments}" />
			<Parameter	Name="ProductDossier"		Direction="In"		Value="${SelectedProductDossier}" />
		</Message>

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