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

ActionField1222

Beschrijving: Select an ObjectJobPlan and add it to the Job by creating a link (JobJobPlan). Custom: Nee

Propertiesbewerken

Property Type Accessor
Job Job Root
AutoApproveJobJobPlan Boolean Optional
EquipmentContext Context Optional
EquipmentTypeContext Context Optional
JobPlanContext Context Optional
SelectionListConfiguration UltimoString Optional

XMLbewerken

<Workflow Name="ActionField1222" Version="2025.07.28" WorkflowType="Standard" xmlns="urn:Ultimo.Framework.Workflow-mapping">
	<Security EditLevel="10" ViewLevel="20" UserContentLevel="30" />
	<Description>Select an ObjectJobPlan and add it to the Job by creating a link (JobJobPlan).</Description>
	<Properties>
		<Property	Name="Job"											Type="Job"						Accessor="Root"		Direction="In" />

		<Property	Name="AutoApproveJobJobPlan"						Type="Boolean"					Accessor="Optional"	Direction="In"		Default="False"							Comment="Set to True to automatically approve new JobJobPlans. Default is False." />
		<Property	Name="EquipmentContext"								Type="Context"					Accessor="Optional"	Direction="In"		Default="EquipmentContext.Fleet"		Comment="Context used for Equipment in messages" />
		<Property	Name="EquipmentTypeContext"							Type="Context"					Accessor="Optional"	Direction="In"		Default="EquipmentTypeContext.Fleet"	Comment="Context used for EquipmentType messages" />
		<Property	Name="JobPlanContext"								Type="Context"					Accessor="Optional"	Direction="In"		Default="JobPlanContext.Fleet"			Comment="Select only 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="ArticleSite"									Type="ArticleSite"				Accessor="Internal" />
		<Property	Name="CheckWarning"									Type="UltimoString"				Accessor="Internal" />
		<Property	Name="IsFeatureToggleInspectionsNewStyleEnabled"	Type="Boolean"					Accessor="Internal" />
		<Property	Name="JobJobPlan"									Type="JobJobPlan"				Accessor="Internal" />
		<Property	Name="JobPlanMaterials"								Type="List[JobPlanMaterial]"	Accessor="Internal" />
		<Property	Name="ObjectJobPlanList"							Type="List[ObjectJobPlan]"		Accessor="Internal" />
		<Property	Name="ObjectJobPlanQueryResult"						Type="QueryResult"				Accessor="Internal" />
		<Property	Name="OriginalJobScheduledStartDate"				Type="DateTime?"				Accessor="Internal"																Comment="To detect if the ScheduledStartDate has been changed." />
		<Property	Name="OriginalJobSLATargetDate"						Type="DateTime?"				Accessor="Internal"																Comment="To detect if the SLA TargetDate has been changed." />
		<Property	Name="OriginalJobTargetDate"						Type="DateTime?"				Accessor="Internal"																Comment="To detect if the TargetDate has been changed." />
		<Property	Name="SelectedJobPlan"								Type="JobPlan"					Accessor="Internal" />
		<Property	Name="SelectedObjectJobPlan"						Type="ObjectJobPlan"			Accessor="Internal" />
		<Property	Name="ShowMessage"									Type="Boolean"					Accessor="Internal" />
		<Property	Name="SkillCategory"								Type="QueryResult"				Accessor="Internal" />
		<Property	Name="SqlWhereClause"								Type="UltimoString"				Accessor="Internal" />
		<Property	Name="ThrowValidation"								Type="Boolean"					Accessor="Internal"						Default="False" />
	</Properties>
	<Execution>
		<UserContent Name="Pre" />

		<Transaction>
			<Validation Name="ValidateJobIsNotFinishedYet" Condition="${Job.Status} == JobStatus.Created || ${Job.Status} == JobStatus.Requested || ${Job.Status} == JobStatus.Approved || ${Job.Status} == JobStatus.Active" MessageCode="2663">
				<Parameter	Name="Job"				Direction="In"		Value="${Job}" />
				<Parameter	Name="JobPlanContext"	Direction="In"		Value="${JobPlanContext}" />
			</Validation>

			<When Name="When context on Job is Fleet" Condition="${Job.Context} == JobContext.Fleet">
				<Validation Name="ValidateJobHasEquipmentOrEquipmentTypeToAddJobPlanFor" Condition="${Job.Equipment} != Empty || ${Job.EquipmentType} != Empty" MessageCode="2656">
					<Parameter	Name="EquipmentContext"		Direction="In"		Value="${EquipmentContext}" />
					<Parameter	Name="EquipmentTypeContext"	Direction="In"		Value="${EquipmentTypeContext}" />
					<Parameter	Name="Job"					Direction="In"		Value="${Job}" />
				</Validation>
			</When>

			<Query Name="Query the Id of the SkillCategory for this Job's JobPlan (if applicable)" Type="JobJobPlan" OutputProperty="${SkillCategory}">
				<Joins>
					<Join	Name="JobPlan"			Alias="jp"	Type="InnerJoin" />
					<Join	Name="jp.SkillCategory"	Alias="skc"	Type="InnerJoin" />
				</Joins>
				<Filters>
					<PropertyFilter	PropertyName="Job"			Operator="="		PropertyValue="${Job}" />
					<PropertyFilter	PropertyName="jp.Status"	Operator="&gt;="	PropertyValue="0"		Comment="Do not include trashed records" />
				</Filters>
				<Properties>
					<Property Name="skc.Id" Alias="id" Type="GroupProperty" />
				</Properties>
			</Query>
		</Transaction>

		<Choose Name="Check context on Job">
			<When Name="When context is Fleet" Condition="${Job.Context} == JobContext.Fleet">
				<Transaction>
					<WorkflowCall Name="ObjectJobPlan_GetListForEquipment" WorkflowName="ObjectJobPlan_GetListForEquipment">
						<Parameter	Name="Equipment"		Direction="In"		Value="${Job.Equipment}" />
						<Parameter	Name="EquipmentType"	Direction="In"		Value="${Job.EquipmentType}" />
						<Parameter	Name="JobPlanContext"	Direction="In"		Value="${JobPlanContext}" />
						<Parameter	Name="SkillCategory"	Direction="In"		Value="${SkillCategory}" />
						<Parameter	Name="ObjectJobPlans"	Direction="Out"										OutputProperty="${ObjectJobPlanList}" />
					</WorkflowCall>

					<Validation Name="ValidateJobPlansFoundForEquipmentOrEquipmentType" Condition="${ObjectJobPlanList} != Empty &amp;&amp; ${ObjectJobPlanList.Count} != 0" MessageCode="2657">
						<Parameter	Name="EquipmentContext"		Direction="In"		Value="${EquipmentContext}" />
						<Parameter	Name="EquipmentTypeContext"	Direction="In"		Value="${EquipmentTypeContext}" />
					</Validation>

					<Assign Name="Build additional SQL WHERE clause" Property="${AdditionalSqlWhereClause}" Value="AND ObjjpId IN (#foreach(${JobPlan} in ${ObjectJobPlanList})#each'${JobPlan.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 Job" Type="JobPlan" OrderBy="Id" OrderDirection="Ascending" OutputProperty="${ObjectJobPlanQueryResult}">
						<Joins>
							<Join	Name="SkillCategory"	Alias="skc"	Type="LeftOuterJoin" />
						</Joins>
						<Filters>
							<PropertyFilter	PropertyName="Context"	Operator="="		PropertyValue="${JobPlanContext}" />
							<PropertyFilter	PropertyName="Status"	Operator="&gt;="	PropertyValue="0"					Comment="Do not include trashed records" />
							<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; ${ObjectJobPlanQueryResult.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(${JobPlan} in ${ObjectJobPlanQueryResult})#each'${JobPlan.id}'#between,#end)" />
					<Assign Name="Add addition to SQL WHERE clause" Property="${SqlWhereClause}" Value="=#concat(${SqlWhereClause}, ' ', ${AdditionalSqlWhereClause})" />
				</When>

				<SystemDialog Name="DialogSelectJobPlan" 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>

		<WorkflowCall Name="JobPlan_ValidateMultiCompanyJobPlanMaterial" WorkflowName="JobPlan_ValidateMultiCompanyJobPlanMaterial">
			<Parameter	Name="JobPlan"			Direction="In"		Value="${SelectedJobPlan}" />
			<Parameter	Name="ThrowValidation"	Direction="Out"									OutputProperty="${ThrowValidation}" />
		</WorkflowCall>

		<Validation Name="JobPlan contains materials and multiple companies" Condition="${ThrowValidation} == False" MessageCode="3662">
			<Parameter	Name="JobPlan"	Direction="In"		Value="${SelectedJobPlan}" />
		</Validation>

		<When Name="StockLevelPerSite is true" Condition="#{UltimoSettings.StockLevelPerSite} == true">
			<Transaction>
				<GetList Name="JobPlanMaterial" Type="JobPlanMaterial" OutputProperty="${JobPlanMaterials}" OrderBy="Id" OrderDirection="Ascending">
					<Filters>
						<PropertyFilter	PropertyName="Id.JobPlan"	Operator="="		PropertyValue="${SelectedJobPlan}" />
					</Filters>
				</GetList>

				<When Name="JobPlanMaterials found" Condition="${JobPlanMaterials.Count} &gt; 0">
					<Validation Name="Check Job.site is null" Condition="${Job.Site} != Empty" MessageCode="3637">
						<Parameter	Name="Job"		Direction="In"		Value="${Job}" />
						<Parameter	Name="JobPlan"	Direction="In"		Value="${SelectedJobPlan}" />
					</Validation>

					<ForEach Name="Loop JobPlanMaterials" In="${JobPlanMaterials}" As="JobPlanMaterial">
						<GetItem Name="Get ArticleSite" Type="ArticleSite" OutputProperty="${ArticleSite}">
							<Filters>
								<CombinedFilter FilterOperator="And">
									<PropertyFilter	PropertyName="Id.Article"	Operator="="		PropertyValue="${JobPlanMaterial.Id.Article}" />
									<PropertyFilter	PropertyName="Id.Site"		Operator="="		PropertyValue="${Job.Site}" />
								</CombinedFilter>
							</Filters>
						</GetItem>

						<Validation Name="Check ArticleSite" Condition="${ArticleSite} != Empty" MessageCode="3638">
							<Parameter	Name="Article"	Direction="In"		Value="${JobPlanMaterial.Id.Article}" />
							<Parameter	Name="JobPlan"	Direction="In"		Value="${SelectedJobPlan}" />
							<Parameter	Name="Site"		Direction="In"		Value="${Job.Site}" />
						</Validation>
					</ForEach>
				</When>
			</Transaction>
		</When>

		<Assign Name="OriginalJobScheduledStartDate" Property="${OriginalJobScheduledStartDate}" Value="${Job.ScheduledStartDate}" />
		<Assign Name="OriginalJobTargetDate" Property="${OriginalJobTargetDate}" Value="${Job.TargetDate}" />
		<Assign Name="OriginalJobSLATargetDate" Property="${OriginalJobSLATargetDate}" Value="${Job.ServiceContractTargetFinishedDate}" />

		<WorkflowCall Name="Create a link (JobJobPlan) between the selected template (JobPlan) and the Job" WorkflowName="JobJobPlan_CreateJobJobPlanForJobPlanAndJob">
			<Parameter	Name="AutoApproveJobJobPlan"	Direction="In"		Value="${AutoApproveJobJobPlan}" />
			<Parameter	Name="Job"						Direction="In"		Value="${Job}" />
			<Parameter	Name="JobPlan"					Direction="In"		Value="${SelectedJobPlan}" />
			<Parameter	Name="CheckWarning"				Direction="Out"											OutputProperty="${CheckWarning}" />
			<Parameter	Name="JobJobPlan"				Direction="Out"											OutputProperty="${JobJobPlan}" />
			<Parameter	Name="ShowMessage"				Direction="Out"											OutputProperty="${ShowMessage}" />
		</WorkflowCall>

		<When Name="Show Message?" Condition="${ShowMessage} == True">
			<Command Name="Job_IsFeatureToggleInspectionsNewStyleEnabled" CommandName="Job_IsFeatureToggleInspectionsNewStyleEnabled">
				<Parameter	Name="Job"						Direction="In"		Value="${Job}" />
				<Parameter	Name="FeatureToggleIsEnabled"	Direction="Out"						OutputProperty="${IsFeatureToggleInspectionsNewStyleEnabled}" />
			</Command>

			<When Name="IsFeatureToggleInspectionsNewStyleEnabled?" Condition="${IsFeatureToggleInspectionsNewStyleEnabled} == True">
				<Message Name="Inform user about double JobPlan" MessageCode="3708" />
			</When>
		</When>

		<Choose Name="choose pertinent warning">
			<When Name="CheckWarning == Job_WarnIfTargetDateIsPastSLATargetDate?" Condition="${CheckWarning} == 'Job_WarnIfTargetDateIsPastSLATargetDate'">
				<WorkflowCall Name="Job_WarnIfTargetDateIsPastSLATargetDate" WorkflowName="Job_WarnIfTargetDateIsPastSLATargetDate">
					<Parameter	Name="Job"						Direction="In"		Value="${Job}" />
					<Parameter	Name="OriginalJobSLATargetDate"	Direction="In"		Value="${OriginalJobSLATargetDate}" />
					<Parameter	Name="OriginalJobTargetDate"	Direction="In"		Value="${OriginalJobTargetDate}" />
				</WorkflowCall>
			</When>


			<When Name="CheckWarning == Job_WarnIfStartOrTargetDateIsInThePast?" Condition="${CheckWarning} == 'Job_WarnIfStartOrTargetDateIsInThePast'">
				<WorkflowCall Name="Job_WarnIfStartOrTargetDateIsInThePast" WorkflowName="Job_WarnIfStartOrTargetDateIsInThePast">
					<Parameter	Name="Job"								Direction="In"		Value="${Job}" />
					<Parameter	Name="OriginalJobScheduledStartDate"	Direction="In"		Value="${OriginalJobScheduledStartDate}" />
					<Parameter	Name="OriginalJobTargetDate"			Direction="In"		Value="${OriginalJobTargetDate}" />
				</WorkflowCall>
			</When>
		</Choose>

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