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

ActionField046

Beschrijving: Copy JobPlan to Job. The linked records (InspectionLines, Materials, Externals, Tools, Resources and PurchaseRequestLines) from the JobPlan will be copied to the Job (existing records will be deleted). When the Job already has linked records, there will be a question informing that the existing information on the Job will be replaced by the information from the JobPlan. Custom: Nee

Propertiesbewerken

Property Type Accessor
Job Job Root
PurchaseRequestLineContext Context Optional
PurchaseRequestLineStatus Status Optional
PurchaseRequestStatus Status Optional
CheckWarning UltimoString Optional

XMLbewerken

<Workflow Name="ActionField046" Version="2025.07.28" WorkflowType="Standard" xmlns="urn:Ultimo.Framework.Workflow-mapping">
	<Security EditLevel="10" ViewLevel="20" UserContentLevel="30" />
	<Description>Copy JobPlan to Job. The linked records (InspectionLines, Materials, Externals, Tools, Resources and PurchaseRequestLines) from the JobPlan will be copied to the Job (existing records will be deleted). When the Job already has linked records, there will be a question informing that the existing information on the Job will be replaced by the information from the JobPlan.</Description>
	<Properties>
		<Property	Name="Job"							Type="Job"				Accessor="Root"		Direction="In" />

		<Property	Name="PurchaseRequestLineContext"	Type="Context"			Accessor="Optional"	Direction="In"						Comment="Set this context to the copied PurchaseRequestLines." />
		<Property	Name="PurchaseRequestLineStatus"	Type="Status"			Accessor="Optional"	Direction="In"						Comment="Set this status to the copied PurchaseRequestLines." />
		<Property	Name="PurchaseRequestStatus"		Type="Status"			Accessor="Optional"	Direction="In"						Comment="Set this status to the copied PurchaseRequest." />

		<Property	Name="CheckWarning"					Type="UltimoString"		Accessor="Optional"	Direction="Out"						Comment="check Warning" />

		<Property	Name="DetailLinesFound"				Type="Boolean"			Accessor="Internal" />
		<Property	Name="OriginalDuration"				Type="Decimal"			Accessor="Internal"										Comment="check duration as provided by jobplan with original duration" />
		<Property	Name="PreviousJobPlan"				Type="JobPlan"			Accessor="Internal" />
		<Property	Name="QuestionOutput"				Type="RequestResult"	Accessor="Internal"						Default="Ok" />
	</Properties>
	<Execution>
		<UserContent Name="Pre" />

		<WorkflowCall Name="Get previous JobPlan" WorkflowName="Job_GetPreviousJobPlan">
			<Parameter	Name="Job"				Direction="In"		Value="${Job}" />
			<Parameter	Name="PreviousJobPlan"	Direction="Out"						OutputProperty="${PreviousJobPlan}" />
		</WorkflowCall>

		<When Name="Check if Job is from PM and user attempted to delete it" Condition="${Job.PmJob} != Empty &amp;&amp; ${Job.PmJob.JobPlan} != Empty &amp;&amp; ${Job.PmJob.JobPlan} != ${Job.JobPlan}">
			<Message Name="User cannot delete JobPlan from PM" MessageCode="3712">
				<Parameter	Name="Cancel"	Direction="In"		Value="False" />
				<Parameter	Name="Job"		Direction="In"		Value="${Job}" />
				<Parameter	Name="JobPlan"	Direction="In"		Value="${Job.PmJob.JobPlan}" />
				<Parameter	Name="PmJob"	Direction="In"		Value="${Job.PmJob}" />
			</Message>

			<Transaction>
				<Assign Name="Place back JobPlan" Property="${Job.JobPlan}" Value="${Job.PmJob.JobPlan}" />
			</Transaction>

			<Stop Name="Stop" Mode="EndCurrent" />
		</When>

		<WorkflowCall Name="Check job for open detail lines" WorkflowName="JobPlan_CheckDetailLines">
			<Parameter	Name="Job"				Direction="In"		Value="${Job}" />
			<Parameter	Name="PreviousJobPlan"	Direction="In"		Value="${PreviousJobPlan}" />
			<Parameter	Name="DetailLinesFound"	Direction="Out"									OutputProperty="${DetailLinesFound}" />
		</WorkflowCall>

		<When Name="Show message when previous jobplan is available and detail lines are found" Condition="${PreviousJobPlan} != Empty &amp;&amp; ${DetailLinesFound} == True &amp;&amp; ${Job.Status} != JobStatus.Created &amp;&amp; ${Job.Status} != JobStatus.Approved">
			<Question Name="Change despite job detail lines?" Type="YesNo" MessageCode="3685" Default="Yes" OutputProperty="${QuestionOutput}">
				<Parameter	Name="Action"	Direction="In"		Value="Change" />
				<Parameter	Name="JobPlan"	Direction="In"		Value="${PreviousJobPlan}" />
			</Question>
		</When>

		<Choose Name="Get new JobPlan or remove Old JobPlan">
			<When Name="Detail lines found, question no" Condition="${DetailLinesFound} == True &amp;&amp; ${QuestionOutput} == No &amp;&amp; ${PreviousJobPlan} != Empty">
				<Transaction>
					<Assign Name="Assign previous JobPlan" Property="${Job.JobPlan}" Value="${PreviousJobPlan}" />
				</Transaction>

				<Stop Name="Stop" Mode="EndCurrent" />
			</When>


			<When Name="New JobPlan is selected" Condition="(${Job.JobPlan} != Empty &amp;&amp; (${DetailLinesFound} == True &amp;&amp; (${QuestionOutput} == Yes || ${QuestionOutput} == Ok))) || (${Job.JobPlan} != Empty &amp;&amp; ${PreviousJobPlan} == Empty)">
				<Transaction>
					<Command Name="Job_CopyJobPlan" CommandName="Job_CopyJobPlan">
						<Parameter	Name="Job"							Direction="In"		Value="${Job}" />
						<Parameter	Name="JobPlan"						Direction="In"		Value="${Job.JobPlan}" />
						<Parameter	Name="JobPlanCopyType"				Direction="In"		Value="CopyStandard" />
						<Parameter	Name="KeepApprovedDetailLines"		Direction="In"		Value="True" />
						<Parameter	Name="PurchaseRequestLineContext"	Direction="In"		Value="${PurchaseRequestLineContext}" />
						<Parameter	Name="PurchaseRequestLineStatus"	Direction="In"		Value="${PurchaseRequestLineStatus}" />
						<Parameter	Name="PurchaseRequestStatus"		Direction="In"		Value="${PurchaseRequestStatus}" />
						<Parameter	Name="UpdateJob"					Direction="In"		Value="True" />
					</Command>
				</Transaction>

				<Message Name="ummJOBPLANCOPIED" MessageCode="0255">
					<Parameter	Name="Job"		Direction="In"		Value="${Job}" />
					<Parameter	Name="JobPlan"	Direction="In"		Value="${Job.JobPlan}" />
				</Message>

				<Assign Name="set OriginalDuration" Property="${OriginalDuration}" Value="${Job.DurationCalculated}" />
				<Assign Name="set the new duration to the job" Property="${Job.DurationCalculated}" Value="${Job.JobPlan.DurationCalculated}" />

				<WorkflowCall Name="Job_CalculatePlanningDatesBasedOnDuration" WorkflowName="Job_CalculatePlanningDatesBasedOnDuration">
					<Parameter	Name="Job"				Direction="In"		Value="${Job}" />
					<Parameter	Name="LabelForDialog"	Direction="In"		Value="MODIFIED_DURATIONCALCULATEDTHROUGHJOBPLAN" />
					<Parameter	Name="CheckWarning"		Direction="Out"															OutputProperty="${CheckWarning}" />
				</WorkflowCall>

				<When Name="When new duration is not ok" Condition="${CheckWarning} == True">
					<Transaction>
						<Assign Name="set back the original duration" Property="${Job.DurationCalculated}" Value="${OriginalDuration}" />
					</Transaction>
				</When>
			</When>


			<When Name="JobPlan is emptied" Condition="${Job.JobPlan} == Empty &amp;&amp; ${PreviousJobPlan} != Empty">
				<WorkflowCall Name="Remove open detail lines when JobPlan is removed" WorkflowName="JobPlan_DeleteOpenDetailLines">
					<Parameter	Name="Job"		Direction="In"		Value="${Job}" />
					<Parameter	Name="JobPlan"	Direction="In"		Value="${PreviousJobPlan}" />
				</WorkflowCall>
			</When>
		</Choose>

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