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

ActionField1261

Beschrijving: Change status of JobJobPlan (product) to Canceled. Custom: Nee

Propertiesbewerken

Property Type Accessor
JobJobPlan JobJobPlan Root
ContactPersonContext Context Optional
SkipQuestionJobScheduleParts Boolean Optional

XMLbewerken

<Workflow Name="ActionField1261" Version="2025.07.28" WorkflowType="Standard" xmlns="urn:Ultimo.Framework.Workflow-mapping">
	<Security EditLevel="10" ViewLevel="20" UserContentLevel="30" />
	<Description>Change status of JobJobPlan (product) to Canceled.</Description>
	<Properties>
		<Property	Name="JobJobPlan"						Type="JobJobPlan"			Accessor="Root"		Direction="In" />

		<Property	Name="ContactPersonContext"				Type="Context"				Accessor="Optional"	Direction="In"		Default="EmployeeContext.ContactPerson"		Comment="Context used for label in dialog" />
		<Property	Name="SkipQuestionJobScheduleParts"		Type="Boolean"				Accessor="Optional"	Direction="In"		Default="False"								Comment="Set to True to skip question and automatically remove JobScheduleParts" />

		<Property	Name="CanceledCustomerContactPerson"	Type="ObjectContact"		Accessor="Internal" />
		<Property	Name="CanceledCustomerDate"				Type="DateTime"				Accessor="Internal"						Default="#{Environment.CurrentDateTime}" />
		<Property	Name="CanceledCustomerRemarks"			Type="UltimoString"			Accessor="Internal" />
		<Property	Name="ContactPersons"					Type="List[ObjectContact]"	Accessor="Internal" />
		<Property	Name="DetailLinesFound"					Type="Boolean"				Accessor="Internal" />
		<Property	Name="InspectionLineCount"				Type="Int64"				Accessor="Internal" />
		<Property	Name="JobSchedulePartCount"				Type="Int64"				Accessor="Internal" />
		<Property	Name="ProductWasApproved"				Type="Boolean"				Accessor="Internal"						Default="False" />
		<Property	Name="RequestLineInOrderProcessCount"	Type="Int64"				Accessor="Internal" />
		<Property	Name="RequestLineInTenderProcessCount"	Type="Int64"				Accessor="Internal" />
	</Properties>
	<Settings>
		<SettingsGroup Name="JobResource">
			<Setting	Name="RemoveJobScheduleParts"	Type="Boolean" />
		</SettingsGroup>
	</Settings>
	<Execution>
		<UserContent Name="Pre" />

		<Validation Name="JobJobPlan from Pm Check" Condition="${JobJobPlan.Job.PmJob} == Empty" MessageCode="3713">
			<Parameter	Name="JobPlan"	Direction="In"		Value="${JobJobPlan.JobPlan}" />
			<Parameter	Name="PmJob"	Direction="In"		Value="${JobJobPlan.Job.PmJob}" />
		</Validation>

		<WorkflowCall Name="Check linked reported faults" WorkflowName="JobInspectionLine_ValidateLinkedReportedFaults">
			<Parameter	Name="Action"		Direction="In"		Value="CancelJobJobPlan" />
			<Parameter	Name="JobJobPlan"	Direction="In"		Value="${JobJobPlan}" />
		</WorkflowCall>

		<Transaction>
			<When Name="When product is currently approved" Condition="${JobJobPlan.Status} == JobJobPlanStatus.Approved" Comment="If product is not yet approved, no work instruction was copied yet!">
				<Assign Name="Set flag to show message after status change" Property="${ProductWasApproved}" Value="True" />
			</When>

			<GetCount Name="Count scheduled parts for JobResources" Type="JobSchedulePart" OutputProperty="${JobSchedulePartCount}">
				<Joins>
					<Join	Name="JobResource"	Alias="jobr"	Type="InnerJoin" />
				</Joins>
				<Filters>
					<PropertyFilter	PropertyName="jobr.JobJobPlan"	Operator="="		PropertyValue="${JobJobPlan}" />
				</Filters>
			</GetCount>

			<GetCount Name="Count purchase request lines in order process" Type="PurchaseRequestLine" OutputProperty="${RequestLineInOrderProcessCount}">
				<Filters>
					<PropertyFilter	PropertyName="JobJobPlan"	Operator="="		PropertyValue="${JobJobPlan}" />
					<InFilter PropertyName="Status" Values="PurchaseRequestLineStatus.PurchaseCreated, PurchaseRequestLineStatus.PartiallyDelivered, PurchaseRequestLineStatus.Delivered, PurchaseRequestLineStatus.Closed" />
				</Filters>
			</GetCount>

			<GetCount Name="Count purchase request lines in tender process" Type="PurchaseRequestLine" OutputProperty="${RequestLineInTenderProcessCount}">
				<Filters>
					<PropertyFilter	PropertyName="JobJobPlan"	Operator="="		PropertyValue="${JobJobPlan}" />
					<PropertyFilter	PropertyName="Status"		Operator="="		PropertyValue="PurchaseRequestLineStatus.Tender" />
				</Filters>
			</GetCount>
		</Transaction>

		<When Name="When purchase request lines found in order/tender process" Condition="${RequestLineInOrderProcessCount} != 0 || ${RequestLineInTenderProcessCount} != 0">
			<ContinuationQuestion Name="ContinueDespiteRequestLinesInOrderOrTenderProcess" MessageCode="2685">
				<Parameter	Name="OrderProcess"		Direction="In"		Value="=${RequestLineInOrderProcessCount} != 0" />
				<Parameter	Name="Single"			Direction="In"		Value="True" />
				<Parameter	Name="TenderProcess"	Direction="In"		Value="=${RequestLineInTenderProcessCount} != 0" />
			</ContinuationQuestion>
		</When>

		<When Name="When scheduled parts found" Condition="${JobSchedulePartCount} != 0 &amp;&amp; ${SkipQuestionJobScheduleParts} == False">
			<ContinuationQuestion Name="ContinueAndRemoveScheduledPartsFromPlanning" MessageCode="2684" Default="Yes">
				<Parameter	Name="Single"	Direction="In"		Value="True" />
			</ContinuationQuestion>
		</When>

		<WorkflowCall Name="Open detail line check" WorkflowName="JobJobPlan_CheckOpenDetailLines">
			<Parameter	Name="JobJobPlan"		Direction="In"		Value="${JobJobPlan}" />
			<Parameter	Name="DetailLinesFound"	Direction="Out"								OutputProperty="${DetailLinesFound}" />
		</WorkflowCall>

		<When Name="Open detail lines found" Condition="${DetailLinesFound} == True">
			<ContinuationQuestion Name="ContinueDespiteOpenDetailLines" MessageCode="3726">
				<Parameter	Name="Action"	Direction="In"		Value="Cancel" />
				<Parameter	Name="JobPlan"	Direction="In"		Value="${JobJobPlan.JobPlan}" />
			</ContinuationQuestion>

			<Assign Name="Allow deletion in JobInspectionLine_PreTrash because JobPlan is about to be cancelled" Property="#{Settings.JobJobPlan.Cancelling}" Value="True" />
		</When>

		<Transaction>
			<Assign Name="Set setting for status transition logic" Property="#{Settings.JobResource.RemoveJobScheduleParts}" Value="True" />

			<Choose Name="Check if a contact person is set on job">
				<When Name="When contact person is set" Condition="${JobJobPlan.Job.CustomerContactPerson} != Empty">
					<GetItem Name="Get" Type="ObjectContact" OutputProperty="${CanceledCustomerContactPerson}">
						<Filters>
							<PropertyFilter	PropertyName="Customer"	Operator="="		PropertyValue="${JobJobPlan.Job.Customer}" />
							<PropertyFilter	PropertyName="Employee"	Operator="="		PropertyValue="${JobJobPlan.Job.CustomerContactPerson}" />
						</Filters>
					</GetItem>
				</When>

				<Otherwise Name="Otherwise, no contact person is set">
					<GetList Name="Get contact persons for this job's customer, if any" Type="ObjectContact" OutputProperty="${ContactPersons}" OrderBy="Id" OrderDirection="Ascending">
						<Filters>
							<PropertyFilter	PropertyName="Customer"	Operator="="		PropertyValue="${JobJobPlan.Job.Customer}" />
							<NotFilter>
								<PropertyEmptyFilter PropertyName="Employee" />
							</NotFilter>
						</Filters>
					</GetList>

					<When Name="When there's only one contact person found" Condition="${ContactPersons.Count} == 1">
						<Assign Name="Prefill for dialog" Property="${CanceledCustomerContactPerson}" Value="${ContactPersons[0]}" />
					</When>
				</Otherwise>
			</Choose>
		</Transaction>

		<WorkflowCall Name="Get cancellation details" WorkflowName="Dialog_JobJobPlan_GetCancellationDetails">
			<Parameter	Name="ContactPersonContext"				Direction="In"		Value="${ContactPersonContext}" />
			<Parameter	Name="Customer"							Direction="In"		Value="${JobJobPlan.Job.Customer}" />
			<Parameter	Name="DomainObject"						Direction="In"		Value="${JobJobPlan}" />
			<Parameter	Name="IsPlural"							Direction="In"		Value="False" />
			<Parameter	Name="CanceledCustomerContactPerson"	Direction="InOut"	Value="${CanceledCustomerContactPerson}"	OutputProperty="${CanceledCustomerContactPerson}" />
			<Parameter	Name="CanceledCustomerDate"				Direction="InOut"	Value="${CanceledCustomerDate}"				OutputProperty="${CanceledCustomerDate}" />
			<Parameter	Name="CanceledCustomerRemarks"			Direction="Out"													OutputProperty="${CanceledCustomerRemarks}" />
		</WorkflowCall>

		<Transaction>
			<ChangeStatus Name="Cancel product" DomainObject="${JobJobPlan}" NewStatus="JobJobPlanStatus.Canceled" />

			<Assign Name="Set cancellation customer contant person" Property="${JobJobPlan.CanceledCustomerContactPerson}" Value="${CanceledCustomerContactPerson.Employee?}" />
			<Assign Name="Set cancellation customer date" Property="${JobJobPlan.CanceledDateCustomerContactPerson}" Value="${CanceledCustomerDate}" />

			<When Name="When remarks are not empty" Condition="#htmltoplain(${CanceledCustomerRemarks}) != Empty">
				<Command Name="Append text to internal remarks" CommandName="DomainObject_AppendComment">
					<Parameter	Name="AddTextAboveTotalText"	Direction="In"		Value="#{Settings.Job.AddTextAboveTotalText}" />
					<Parameter	Name="DomainObject"				Direction="In"		Value="${JobJobPlan}" />
					<Parameter	Name="Property"					Direction="In"		Value="RemarkText" />
					<Parameter	Name="ShowEmployee"				Direction="In"		Value="True" />
					<Parameter	Name="TextToAppend"				Direction="In"		Value="${CanceledCustomerRemarks}" />
				</Command>
			</When>
		</Transaction>

		<When Name="When product was already approved" Condition="${ProductWasApproved} == True">
			<Message Name="JobTextMightContainInfoThatWillNoLongerBeApplicable" MessageCode="2669">
				<Parameter	Name="JobPlan"	Direction="In"		Value="${JobJobPlan.JobPlan}" />
			</Message>
		</When>

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