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

ActionField1255

Beschrijving: Change status of JobJobPlans (products) linked to Job to Quotation, create quotation/pro-forma report and save it as PDF document linked to Job. Custom: Nee

Propertiesbewerken

Property Type Accessor
Job Job Root
FileSystemPath FileSystemPath Optional
IsProForma Boolean Optional
SendManualEmail Boolean Optional

XMLbewerken

<Workflow Name="ActionField1255" Version="2025.07.28" WorkflowType="Standard" xmlns="urn:Ultimo.Framework.Workflow-mapping">
	<Security EditLevel="10" ViewLevel="20" UserContentLevel="30" />
	<Description>Change status of JobJobPlans (products) linked to Job to Quotation, create quotation/pro-forma report and save it as PDF document linked to Job.</Description>
	<Properties>
		<Property	Name="Job"					Type="Job"				Accessor="Root"		Direction="In" />

		<Property	Name="FileSystemPath"		Type="FileSystemPath"	Accessor="Optional"	Direction="In"		Default="007"	Comment="Fleet" />
		<Property	Name="IsProForma"			Type="Boolean"			Accessor="Optional"	Direction="In"						Comment="Indicates whether a quotation or proforma will be sent." />
		<Property	Name="SendManualEmail"		Type="Boolean"			Accessor="Optional"	Direction="In"						Comment="Indicates whether an email should be sent or a PDF should be printed." />

		<Property	Name="ConceptEmail"			Type="Email"			Accessor="Internal" />
		<Property	Name="DocumentFileName"		Type="String"			Accessor="Internal" />
		<Property	Name="EmailAddress"			Type="String"			Accessor="Internal" />
		<Property	Name="JobDetailsFound"		Type="Boolean"			Accessor="Internal" />
		<Property	Name="JobJobPlans"			Type="List[JobJobPlan]"	Accessor="Internal" />
		<Property	Name="ProductDetailsFound"	Type="Boolean"			Accessor="Internal" />
		<Property	Name="ReportData"			Type="ReportData"		Accessor="Internal" />
	</Properties>
	<Execution>
		<UserContent Name="Pre" />

		<Choose Name="Check if a quotation or pro forma should be created">
			<When Name="Is it a quotation?" Condition="!${IsProForma}">
				<WorkflowCall Name="Check if a quotation can be created" WorkflowName="Job_CheckIfQuotationCanBeCreated">
					<Parameter	Name="Job"					Direction="In"		Value="${Job}" />
					<Parameter	Name="JobDetailsFound"		Direction="Out"						OutputProperty="${JobDetailsFound}" />
					<Parameter	Name="ProductDetailsFound"	Direction="Out"						OutputProperty="${ProductDetailsFound}" />
				</WorkflowCall>
			</When>


			<When Name="Is it a pro forma?" Condition="${IsProForma}">
				<Validation Name="ValidateJobIsSetToBeInvoiced" Condition="${Job.Charge} != Skip" MessageCode="3406">
					<Parameter	Name="Job"		Direction="In"		Value="${Job}" />
					<Parameter	Name="Print"	Direction="In"		Value="False" />
				</Validation>

				<Transaction>
					<Command Name="Check for details to invoice for job" CommandName="Job_HasDetailsToInvoice">
						<Parameter	Name="Job"									Direction="In"		Value="${Job}" />
						<Parameter	Name="HasDetailsLinkedDirectly"				Direction="Out"						OutputProperty="${JobDetailsFound}" />
						<Parameter	Name="HasDetailsLinkedThroughJobJobPlan"	Direction="Out"						OutputProperty="${ProductDetailsFound}" />
					</Command>
				</Transaction>
			</When>
		</Choose>

		<WorkflowCall Name="Create a quotation/pro forma for this job" WorkflowName="Job_CreateQuotationOrProForma">
			<Parameter	Name="FileSystemPath"		Direction="In"		Value="${FileSystemPath}" />
			<Parameter	Name="IsProForma"			Direction="In"		Value="${IsProForma}" />
			<Parameter	Name="Job"					Direction="In"		Value="${Job}" />
			<Parameter	Name="JobDetailsFound"		Direction="In"		Value="${JobDetailsFound}" />
			<Parameter	Name="ProductDetailsFound"	Direction="In"		Value="${ProductDetailsFound}" />
			<Parameter	Name="DocumentFileName"		Direction="Out"										OutputProperty="${DocumentFileName}" />
			<Parameter	Name="ReportData"			Direction="Out"										OutputProperty="${ReportData}" />
		</WorkflowCall>

		<Transaction>
			<GetList Name="Get open products linked to Job" Type="JobJobPlan" OutputProperty="${JobJobPlans}" OrderBy="Id" OrderDirection="Ascending">
				<Filters>
					<PropertyFilter	PropertyName="Job"		Operator="="		PropertyValue="${Job}" />
					<PropertyFilter	PropertyName="Status"	Operator="="		PropertyValue="JobJobPlanStatus.Created" />
				</Filters>
			</GetList>

			<ForEach Name="For each open product linked to this Job" In="${JobJobPlans}" As="JobJobPlan">
				<ChangeStatus Name="Change product to status Quotation" DomainObject="${JobJobPlan}" NewStatus="JobJobPlanStatus.Quotation" />
			</ForEach>
		</Transaction>

		<UserContent Name="Post" />

		<Choose Name="Email or PDF">
			<When Name="CheckSendManualEmail" Condition="${SendManualEmail} == True">
				<Assign Name="Copy email address from CustomerContactPerson" Property="${EmailAddress}" Value="${Job.CustomerContactPerson.EmailAddress?}" />

				<AssignWhenEmpty Name="Copy email address from Customer" Property="${EmailAddress}" Value="${Job.Customer.EmailAddress?}" />
				<AssignWhenEmpty Name="Copy email address from ReportForeignKeyEmployee" Property="${EmailAddress}" Value="${Job.ReportForeignKeyEmployee.EmailAddress?}" />

				<Transaction>
					<Email Name="Mail" From="#{UltimoSettings.EmailSender}" To="${EmailAddress}" RelatedSubjects="${Job}" EmailTemplateCode="=!${IsProForma} ? '00000010002' : '00000000085'" Concept="True" OutputProperty="${ConceptEmail}">
						<Parameters>
							<Parameter	Name="Job"				Direction="In"		Value="${Job}" />
							<Parameter	Name="UserDescription"	Direction="In"		Value="#{User.Description}" />
						</Parameters>
						<Attachments>
							<Attachment FileName="${DocumentFileName}.pdf" Data="${ReportData}" />
						</Attachments>
					</Email>
				</Transaction>

				<WorkflowCall Name="Dialog_Email" WorkflowName="Dialog_Email">
					<Parameter	Name="DomainObject"	Direction="In"		Value="${Job}" />
					<Parameter	Name="Email"		Direction="In"		Value="${ConceptEmail}" />
				</WorkflowCall>

				<When Name="Check Emailaddress" Condition="${ConceptEmail.To} == Empty">
					<Transaction>
						<TrashObject Name="Trash email" DomainObject="${ConceptEmail}" />
					</Transaction>

					<Validation Name="Check EmailAdress when SendManual" Condition="${ConceptEmail.To} != Empty" MessageCode="2688" />
				</When>

				<Transaction>
					<ChangeStatus Name="Send the quotation" DomainObject="${ConceptEmail}" NewStatus="EmailStatus.Draft" />
				</Transaction>
			</When>

			<Otherwise Name="PDF">
				<View Name="Open the quotation" ViewName="Report">
					<Parameter	Name="ReportData"	Direction="In"		Value="${ReportData}" />
				</View>
			</Otherwise>
		</Choose>
	</Execution>
</Workflow>