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

ActionField1623

Beschrijving: Select a JobPlan (ObjectJobPlan) and add it to the PmWorkOrder by creating a link (ObjectJobPlan) between the template (JobPlan) and the PmWorkOder. This actionfield can only be called by backoffices Technical Service, INFRA, Fleet (not IT and building). Custom: Nee

Propertiesbewerken

Property Type Accessor
PmWorkOrder PmWorkOrder Root
EquipmentContext Context Optional
JobPlanContext Context Optional
SelectionListConfiguration UltimoString Optional

XMLbewerken

<Workflow Name="ActionField1623" Version="2025.07.28" WorkflowType="Standard" xmlns="urn:Ultimo.Framework.Workflow-mapping">
	<Security EditLevel="10" ViewLevel="20" UserContentLevel="30" />
	<Description>Select a JobPlan (ObjectJobPlan) and add it to the PmWorkOrder by creating a link (ObjectJobPlan) between the template (JobPlan) and the PmWorkOder. This actionfield can only be called by backoffices Technical Service, INFRA, Fleet (not IT and building).</Description>
	<Properties>
		<Property	Name="PmWorkOrder"					Type="PmWorkOrder"			Accessor="Root"		Direction="In" />

		<Property	Name="EquipmentContext"				Type="Context"				Accessor="Optional"	Direction="In"		Default="EquipmentContext.Fleet"	Comment="Context used for messages" />
		<Property	Name="JobPlanContext"				Type="Context"				Accessor="Optional"	Direction="In"		Default="JobPlanContext.Fleet"		Comment="Only select JobPlans with this context" />
		<Property	Name="SelectionListConfiguration"	Type="UltimoString"			Accessor="Optional"	Direction="In"		Default="JobPlan"					Comment="JobPlans in grid are shown with this SelectionListConfiguration. Default is 'JobPlan'" />

		<Property	Name="AdditionalSqlWhereClause"		Type="UltimoString"			Accessor="Internal" />
		<Property	Name="InspectionLines"				Type="List[InspectionLine]"	Accessor="Internal" />
		<Property	Name="ObjectJobPlan"				Type="ObjectJobPlan"		Accessor="Internal" />
		<Property	Name="ObjectJobPlans"				Type="QueryResult"			Accessor="Internal" />
		<Property	Name="SelectedJobPlan"				Type="JobPlan"				Accessor="Internal" />
		<Property	Name="SelectedObjectJobPlan"		Type="ObjectJobPlan"		Accessor="Internal" />
		<Property	Name="SkillCategory"				Type="QueryResult"			Accessor="Internal" />
		<Property	Name="SqlWhereClause"				Type="UltimoString"			Accessor="Internal" />
	</Properties>
	<Execution>
		<UserContent Name="Pre" />

		<Choose Name="Check backoffice">
			<When Name="TD" Condition="${PmWorkOrder.MaintenanceClassification.BackOffice.JobContext?} == JobContext.TD">
				<Assign Name="Set JobPlanContext.Standard" Property="${JobPlanContext}" Value="JobPlanContext.Standard" />
			</When>


			<When Name="Building" Condition="${PmWorkOrder.MaintenanceClassification.BackOffice.JobContext?} == JobContext.Building">
				<Assign Name="Set JobPlanContext.Building" Property="${JobPlanContext}" Value="JobPlanContext.Building" />
			</When>


			<When Name="Fleet" Condition="${PmWorkOrder.MaintenanceClassification.BackOffice.JobContext?} == JobContext.Fleet">
				<Assign Name="Set JobPlanContext.Fleet" Property="${JobPlanContext}" Value="JobPlanContext.Fleet" />
			</When>


			<When Name="Infra" Condition="${PmWorkOrder.MaintenanceClassification.BackOffice.JobContext?} == JobContext.Infra">
				<Assign Name="Set JobPlanContext.Infra" Property="${JobPlanContext}" Value="JobPlanContext.Infra" />
			</When>


			<When Name="ServiceRequest" Condition="${PmWorkOrder.MaintenanceClassification.BackOffice.JobContext?} == JobContext.ServiceRequest">
				<Assign Name="Set JobPlanContext.ITTemplate" Property="${JobPlanContext}" Value="JobPlanContext.ITTemplate" />
			</When>
		</Choose>

		<Validation Name="ValidatePmWorkOrderIsOpen" Condition="${PmWorkOrder.Status} == PmWorkOrderStatus.Created" MessageCode="3105">
			<Parameter	Name="JobPlanContext"	Direction="In"		Value="${JobPlanContext}" />
			<Parameter	Name="PmWorkOrder"		Direction="In"		Value="${PmWorkOrder}" />
		</Validation>

		<When Name="When context on PmWorkOrder is Fleet" Condition="${PmWorkOrder.Context} == PmWorkOrderContext.Fleet">
			<Validation Name="ValidatePmWorkOrderHasEquipmentToAddJobPlanFor" Condition="${PmWorkOrder.Equipment} != Empty" MessageCode="3104">
				<Parameter	Name="EquipmentContext"	Direction="In"		Value="${EquipmentContext}" />
				<Parameter	Name="PmWorkOrder"		Direction="In"		Value="${PmWorkOrder}" />
			</Validation>
		</When>

		<Transaction>
			<Query Name="Query the Id of the SkillCategory for this PmWorkOrder's JobPlan (if applicable)" Type="ObjectJobPlan" OutputProperty="${SkillCategory}">
				<Joins>
					<Join	Name="JobPlan"			Alias="jp"	Type="InnerJoin" />
					<Join	Name="jp.SkillCategory"	Alias="skc"	Type="InnerJoin" />
				</Joins>
				<Filters>
					<PropertyFilter	PropertyName="PmWorkOrder"	Operator="="		PropertyValue="${PmWorkOrder}" />
				</Filters>
				<Properties>
					<Property Name="skc.Id" Alias="id" Type="GroupProperty" />
				</Properties>
			</Query>
		</Transaction>

		<Choose Name="Check context on PmWorkOrder">
			<When Name="When context is Fleet" Condition="${PmWorkOrder.Context} == PmWorkOrderContext.Fleet">
				<Transaction>
					<Query Name="Query the Ids of all ObjectJobPlans suitable for this PmWorkOrder's Equipment" Type="ObjectJobPlan" OrderBy="Id" OrderDirection="Ascending" OutputProperty="${ObjectJobPlans}">
						<Joins>
							<Join	Name="JobPlan"			Alias="jp"	Type="InnerJoin" />
							<Join	Name="jp.SkillCategory"	Alias="skc"	Type="LeftOuterJoin" />
						</Joins>
						<Filters>
							<WhenFilter Condition="${PmWorkOrder.Equipment.FinishingType?} != Empty">
								<CombinedFilter FilterOperator="Or">
									<PropertyEmptyFilter PropertyName="FinishingType" />
									<PropertyFilter	PropertyName="FinishingType"	Operator="="		PropertyValue="${PmWorkOrder.Equipment.FinishingType}" />
								</CombinedFilter>
							</WhenFilter>
							<WhenFilter Condition="${PmWorkOrder.Equipment.ManufactureYear?} != Empty &amp;&amp; ${PmWorkOrder.Equipment.ManufactureYear} != 0" Comment="A value of zero is considered 'empty'">
								<CombinedFilter FilterOperator="And">
									<CombinedFilter FilterOperator="Or">
										<PropertyFilter	PropertyName="ManufactureYearFrom"	Operator="="		PropertyValue="0"											Comment="A value of zero is considered 'empty'" />
										<PropertyFilter	PropertyName="ManufactureYearFrom"	Operator="&lt;="	PropertyValue="${PmWorkOrder.Equipment.ManufactureYear}" />
									</CombinedFilter>
									<CombinedFilter FilterOperator="Or">
										<PropertyFilter	PropertyName="ManufactureYearTill"	Operator="="		PropertyValue="0"											Comment="A value of zero is considered 'empty'" />
										<PropertyFilter	PropertyName="ManufactureYearTill"	Operator="&gt;="	PropertyValue="${PmWorkOrder.Equipment.ManufactureYear}" />
									</CombinedFilter>
								</CombinedFilter>
							</WhenFilter>
							<WhenFilter Condition="${SkillCategory.Count} != 0">
								<CombinedFilter FilterOperator="Or">
									<PropertyEmptyFilter PropertyName="jp.SkillCategory" />
									<PropertyFilter	PropertyName="skc.Id"	Operator="="		PropertyValue="=#getpropertyvalue(#elementat(${SkillCategory}, 0), 'id')" />
								</CombinedFilter>
							</WhenFilter>
						</Filters>
						<Properties>
							<Property Name="Id" Alias="id" Type="GroupProperty" />
						</Properties>
					</Query>

					<Validation Name="ValidateJobPlansFoundForEquipment" Condition="${ObjectJobPlans.Count} != 0" MessageCode="2661">
						<Parameter	Name="EquipmentContext"	Direction="In"		Value="${EquipmentContext}" />
					</Validation>

					<Assign Name="Build additional SQL WHERE clause" Property="${AdditionalSqlWhereClause}" Value=" AND ObjjpId IN (#foreach(${ObjectJobPlan} in ${ObjectJobPlans})#each'${ObjectJobPlan.id}'#between,#end)" />
					<Assign Name="Build SQL WHERE clause" Property="${SqlWhereClause}" Value="=#concat('ObjjpRecStatus &gt;= 0', ' ', ${AdditionalSqlWhereClause})" />
				</Transaction>

				<SystemDialog Name="DialogSelectObjectJobPlan" DialogName="SelectDomainObject">
					<Parameter	Name="EntityName"					Direction="In"		Value="ObjectJobPlan" />
					<Parameter	Name="SelectionListConfiguration"	Direction="In"		Value="Default" />
					<Parameter	Name="SqlWhereClause"				Direction="In"		Value="${SqlWhereClause}" />
					<Parameter	Name="DomainObject"					Direction="Out"									OutputProperty="${SelectedObjectJobPlan}" />
				</SystemDialog>

				<Assign Name="Set SelectedJobPlan" Property="${SelectedJobPlan}" Value="${SelectedObjectJobPlan.JobPlan}" />
			</When>

			<Otherwise Name="Otherwise, context other than Fleet">
				<Transaction>
					<Query Name="Query the Ids of all JobPlans suitable for this PmWorkOrder" Type="JobPlan" OrderBy="Id" OrderDirection="Ascending" OutputProperty="${ObjectJobPlans}">
						<Joins>
							<Join	Name="SkillCategory"	Alias="skc"	Type="LeftOuterJoin" />
						</Joins>
						<Filters>
							<PropertyFilter	PropertyName="Context"	Operator="="		PropertyValue="${JobPlanContext}" />
							<WhenFilter Condition="${SkillCategory.Count} != 0">
								<CombinedFilter FilterOperator="Or">
									<PropertyEmptyFilter PropertyName="SkillCategory" />
									<PropertyFilter	PropertyName="skc.Id"	Operator="="		PropertyValue="=#getpropertyvalue(#elementat(${SkillCategory}, 0), 'id')" />
								</CombinedFilter>
							</WhenFilter>
						</Filters>
						<Properties>
							<Property Name="Id" Alias="id" Type="GroupProperty" />
						</Properties>
					</Query>
				</Transaction>

				<Assign Name="Build SQL WHERE clause" Property="${SqlWhereClause}" Value="JpRecStatus &gt;= 0 AND JpContext = ${JobPlanContext}" />

				<When Name="When applicable JobPlans limited by SkillCategory found" Condition="${SkillCategory.Count} != 0 &amp;&amp; ${ObjectJobPlans.Count} != 0" Comment="Only the SkillCategory can limit the applicable JobPlans">
					<Assign Name="Build additional SQL WHERE clause" Property="${AdditionalSqlWhereClause}" Value="AND JpId IN (#foreach(${ObjectJobPlan} in ${ObjectJobPlans})#each'${ObjectJobPlan.id}'#between,#end)" />
					<Assign Name="Add addition to SQL WHERE clause" Property="${SqlWhereClause}" Value="=#concat(${SqlWhereClause}, ' ', ${AdditionalSqlWhereClause})" />
				</When>

				<SystemDialog Name="DialogSelectMeeting" DialogName="SelectDomainObject">
					<Parameter	Name="EntityName"					Direction="In"		Value="JobPlan" />
					<Parameter	Name="SelectionListConfiguration"	Direction="In"		Value="${SelectionListConfiguration}" />
					<Parameter	Name="SqlWhereClause"				Direction="In"		Value="${SqlWhereClause}" />
					<Parameter	Name="DomainObject"					Direction="Out"												OutputProperty="${SelectedJobPlan}" />
				</SystemDialog>
			</Otherwise>
		</Choose>

		<Transaction>
			<WorkflowCall Name="Create a link (ObjectJobPlan) between the selected template (JobPlan) and the PmWorkOrder" WorkflowName="ObjectJobPlan_CreateObjectJobPlanForJobPlanAndPmWorkOrder">
				<Parameter	Name="JobPlan"			Direction="In"		Value="${SelectedJobPlan}" />
				<Parameter	Name="PmWorkOrder"		Direction="In"		Value="${PmWorkOrder}" />
				<Parameter	Name="ObjectJobPlan"	Direction="Out"									OutputProperty="${ObjectJobPlan}" />
			</WorkflowCall>
		</Transaction>

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