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

ActionField1798

Beschrijving: Select JobPlan and add its InspectionLines to the current JobPlan. Custom: Nee

Propertiesbewerken

Property Type Accessor
JobPlan JobPlan Root
JobPlanContext Context Optional
SelectionListConfiguration UltimoString Optional

XMLbewerken

<Workflow Name="ActionField1798" Version="2025.07.28" WorkflowType="Standard" xmlns="urn:Ultimo.Framework.Workflow-mapping">
	<Security EditLevel="10" ViewLevel="20" UserContentLevel="30" />
	<Description>Select JobPlan and add its InspectionLines to the current JobPlan.</Description>
	<Properties>
		<Property	Name="JobPlan"							Type="JobPlan"						Accessor="Root"		Direction="In" />

		<Property	Name="JobPlanContext"					Type="Context"						Accessor="Optional"	Direction="In"		Default="JobPlanContext.Standard"	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="JobPlanInspectionLineDestination"	Type="JobPlanInspectionLine"		Accessor="Internal" />
		<Property	Name="JobPlanInspectionLines"			Type="List[JobPlanInspectionLine]"	Accessor="Internal" />
		<Property	Name="MaxCurrentOrderValue"				Type="Int16"						Accessor="Internal" />
		<Property	Name="OffsetNewOrderValue"				Type="Int16"						Accessor="Internal"						Default="1" />
		<Property	Name="SelectedJobPlan"					Type="JobPlan"						Accessor="Internal" />
		<Property	Name="ShouldUpdateOrder"				Type="Boolean"						Accessor="Internal" />
		<Property	Name="SourceIdentifier"					Type="UltimoString"					Accessor="Internal" />
		<Property	Name="SqlWhereClause"					Type="UltimoString"					Accessor="Internal" />
	</Properties>
	<Execution>
		<UserContent Name="Pre" />

		<Assign Name="Build SQL WHERE clause" Property="${SqlWhereClause}" Value="JpRecStatus &gt;= 0 AND JpContext = ${JobPlanContext} AND JpId IN (SELECT JpiJpId FROM dba.JpInsp WHERE JpiRecStatus &gt;= 0)" />

		<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>

		<Transaction>
			<Comment><![CDATA[	Since the dialog only allows for job plans with inspection line(s), the query below will always yield a result.
								Therefor, we can safely index into the list and use the first line to check if auto sorting is enabled. ]]></Comment>

			<GetList Name="Get the first JobPlanInspectionLine" Type="JobPlanInspectionLine" OutputProperty="${JobPlanInspectionLines}" OrderBy="Id" OrderDirection="Ascending" Top="1">
				<Filters>
					<PropertyFilter	PropertyName="Id.JobPlan"	Operator="="		PropertyValue="${SelectedJobPlan}" />
				</Filters>
			</GetList>

			<Command Name="DetermineAutoSortUsageForInspectionLines" CommandName="DetermineAutoSortUsageForInspectionLines">
				<Parameter	Name="InspectionLine"		Direction="In"		Value="${JobPlanInspectionLines[0]}" />
				<Parameter	Name="ShouldUpdateOrder"	Direction="Out"												OutputProperty="${ShouldUpdateOrder}" />
			</Command>

			<Choose Name="Check if order should be updated or not">
				<When Name="Order should be updated" Condition="${ShouldUpdateOrder}">
					<GetMax Name="Get maximum order value of current job plan" Type="JobPlanInspectionLine" OutputProperty="${MaxCurrentOrderValue}" PropertyName="Point">
						<Filters>
							<PropertyFilter	PropertyName="Id.JobPlan"	Operator="="		PropertyValue="${JobPlan}" />
						</Filters>
					</GetMax>

					<GetList Name="Get all JobPlanInspectionLines with sequence order" Type="JobPlanInspectionLine" OutputProperty="${JobPlanInspectionLines}" OrderBy="Point" OrderDirection="Ascending">
						<Filters>
							<PropertyFilter	PropertyName="Id.JobPlan"	Operator="="		PropertyValue="${SelectedJobPlan}" />
						</Filters>
					</GetList>
				</When>

				<Otherwise Name="Otherwise, order should not be updated">
					<GetList Name="Get all JobPlanInspectionLines with default order" Type="JobPlanInspectionLine" OutputProperty="${JobPlanInspectionLines}" OrderBy="Id" OrderDirection="Ascending">
						<Filters>
							<PropertyFilter	PropertyName="Id.JobPlan"	Operator="="		PropertyValue="${SelectedJobPlan}" />
						</Filters>
					</GetList>
				</Otherwise>
			</Choose>

			<ForEach Name="ForEach JobPlanInspectionLine" In="${JobPlanInspectionLines}" As="JobPlanInspectionLineSource">
				<Insert Name="Insert JobPlanInspectionLine" ObjectType="JobPlanInspectionLine" OutputProperty="${JobPlanInspectionLineDestination}">
					<Parameter	Name="Id.JobPlan"	Direction="In"		Value="${JobPlan}" />
				</Insert>

				<Flush Comment="Necessary to obtain SourceIdentifier (a GUID) which was assigned by trigger TRGI_JpIns" />

				<Assign Name="Preserve original SourceIdentifier assigned by trigger TRGI_JpIns" Property="${SourceIdentifier}" Value="${JobPlanInspectionLineDestination.SourceIdentifier}" />

				<Copy Name="Copy Standard Columns" Source="${JobPlanInspectionLineSource}" Target="${JobPlanInspectionLineDestination}" CopyType="Overwrite" CustomOnly="False" />

				<Copy Name="Copy Custom Columns" Source="${JobPlanInspectionLineSource}" Target="${JobPlanInspectionLineDestination}" CopyType="OnlySetIfEmpty" CustomOnly="True" />

				<Assign Name="Restore the original SourceIdentifier" Property="${JobPlanInspectionLineDestination.SourceIdentifier}" Value="${SourceIdentifier}" />

				<When Name="Order should be updated and line is currently part of the sequence" Condition="${ShouldUpdateOrder} &amp;&amp; ${JobPlanInspectionLineDestination.Point} != 0">
					<Assign Name="Update order value" Property="${JobPlanInspectionLineDestination.Point}" Value="= ${MaxCurrentOrderValue} + ${OffsetNewOrderValue}" />

					<Add Name="Increase offset" ValueLeft="${OffsetNewOrderValue}" ValueRight="1" OutputProperty="${OffsetNewOrderValue}" />
				</When>
			</ForEach>
		</Transaction>

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