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

ActionField1547

Beschrijving: Attach document and change ProgressStatus of the Job. Custom: Nee

Propertiesbewerken

Property Type Accessor
Job Job Root
AskForDocumentType Boolean Optional
AskForSite Boolean Optional
DocumentContext Context Optional
DocumentPropertyName String Optional
DocumentStatus Status Optional
FileFilter String Optional
FileSystemPath FileSystemPath Optional
SetProgressStatusToResponseReceived Boolean Optional

XMLbewerken

<Workflow Name="ActionField1547" Version="2025.07.28" WorkflowType="Standard" xmlns="urn:Ultimo.Framework.Workflow-mapping">
	<Security EditLevel="10" ViewLevel="20" UserContentLevel="30" />
	<Description>Attach document and change ProgressStatus of the Job.</Description>
	<Properties>
		<Property	Name="Job"									Type="Job"									Accessor="Root"		Direction="In" />

		<Property	Name="AskForDocumentType"					Type="Boolean"								Accessor="Optional"	Direction="In"		Default="#{Settings.DocumentUpload.AskForDocumentType}"	Comment="Ask for a DocumentType" />
		<Property	Name="AskForSite"							Type="Boolean"								Accessor="Optional"	Direction="In"		Default="#{Settings.DocumentUpload.AskForSite}"			Comment="Ask for a Site" />
		<Property	Name="DocumentContext"						Type="Context"								Accessor="Optional"	Direction="In"		Default="DocumentContext.Standard" />
		<Property	Name="DocumentPropertyName"					Type="String"								Accessor="Optional"	Direction="In"		Default="Document" />
		<Property	Name="DocumentStatus"						Type="Status"								Accessor="Optional"	Direction="In"		Default="DocumentStatus.Active"							Comment="Create Document with this status" />
		<Property	Name="FileFilter"							Type="String"								Accessor="Optional"	Direction="In" />
		<Property	Name="FileSystemPath"						Type="FileSystemPath"						Accessor="Optional"	Direction="In" />
		<Property	Name="SetProgressStatusToResponseReceived"	Type="Boolean"								Accessor="Optional"	Direction="In"		Default="True"											Comment="Set progressstatus of the job to ResponseReceived when a document is linked" />

		<Property	Name="AttachSuccessful"						Type="Boolean"								Accessor="Internal"						Default="False" />
		<Property	Name="DefaultProgressStatusContexts"		Type="List[DefaultProgressStatusContext]"	Accessor="Internal" />
		<Property	Name="FollowUpJob"							Type="Job"									Accessor="Internal" />
		<Property	Name="Jobs"									Type="List[Job]"							Accessor="Internal" />
		<Property	Name="Message"								Type="String"								Accessor="Internal" />
		<Property	Name="ObjectDocument"						Type="ObjectDocument"						Accessor="Internal" />
		<Property	Name="ResponseReceivedProgressStatus"		Type="ProgressStatus"						Accessor="Internal" />
		<Property	Name="ScreenName"							Type="String"								Accessor="Internal"						Default="job101" />
		<Property	Name="UploadedDocuments"					Type="List[Document]"						Accessor="Internal" />
		<Property	Name="ValidPropertyNames"					Type="String"								Accessor="Internal" />
	</Properties>
	<Execution>
		<UserContent Name="Pre" />

		<When Name="Is job context is ServiceDesk" Condition="${Job.Context} == JobContext.ServiceDesk">
			<Validation Name="If job-status is created or requested it is not possible to link a document" Condition="${Job.Status} != JobStatus.Created &amp;&amp; ${Job.Status} != JobStatus.Requested" MessageCode="3467">
				<Parameter	Name="Job"	Direction="In"		Value="${Job}" />
			</Validation>
		</When>

		<When Name="Is job closed" Condition="${Job.Status} == JobStatus.Closed">
			<Comment><![CDATA[ check whether there already is a follow-up job for this job ]]></Comment>

			<Transaction>
				<GetList Name="follow-up job there?" Type="Job" OutputProperty="${Jobs}" OrderBy="Id" OrderDirection="Ascending">
					<Filters>
						<PropertyFilter	PropertyName="ParentJob"	Operator="="		PropertyValue="${Job}" />
					</Filters>
				</GetList>
			</Transaction>

			<Validation Name="Job is closed" Condition="${Jobs.Count} != 0" MessageCode="2836">
				<Parameter	Name="Job"	Direction="In"		Value="${Job}" />
			</Validation>
			<Assign Name="also set FollowUpJob, for OpenScreen" Property="${FollowUpJob}" Value="=#elementat(${Jobs}, 0)" />
		</When>

		<When Name="No Follow up job" Condition="${FollowUpJob} == Empty">
			<When Name="SetProgressStatusToResponseReceived" Condition="${SetProgressStatusToResponseReceived} == true">
				<WorkflowCall Name="Job_ValidateAndGetResponseReceivedProgressStatus" WorkflowName="Job_ValidateAndGetResponseReceivedProgressStatus">
					<Parameter	Name="Job"	Direction="In"		Value="${Job}" />
				</WorkflowCall>
			</When>

			<WorkflowCall Name="UploadDocuments" WorkflowName="UploadDocuments" Comment="Call workflow to move the files from the Upload path to the Media path and create Document objects">
				<Parameter	Name="AskForDocumentType"	Direction="In"		Value="${AskForDocumentType}" />
				<Parameter	Name="AskForSite"			Direction="In"		Value="${AskForSite}" />
				<Parameter	Name="DocumentContext"		Direction="In"		Value="${DocumentContext}" />
				<Parameter	Name="FileFilter"			Direction="In"		Value="${FileFilter}" />
				<Parameter	Name="Site"					Direction="In"		Value="${Job.Site}" />
				<Parameter	Name="FileSystemPath"		Direction="InOut"	Value="${FileSystemPath}"		OutputProperty="${FileSystemPath}" />
				<Parameter	Name="UploadedDocuments"	Direction="Out"										OutputProperty="${UploadedDocuments}" />
			</WorkflowCall>

			<Transaction>
				<ForEach Name="Foreach Document in UploadedDocuments" In="${UploadedDocuments}" As="Document">
					<Command Name="DomainObject_AttachDocument" CommandName="DomainObject_AttachDocument">
						<Parameter	Name="Document"				Direction="In"		Value="${Document}" />
						<Parameter	Name="DomainObject"			Direction="In"		Value="${Job}" />
						<Parameter	Name="PropertyName"			Direction="In"		Value="${DocumentPropertyName}" />
						<Parameter	Name="AttachSuccessful"		Direction="Out"										OutputProperty="${AttachSuccessful}" />
						<Parameter	Name="ValidPropertyNames"	Direction="Out"										OutputProperty="${ValidPropertyNames}" />
					</Command>

					<Command Name="Link Document record to Job" CommandName="CreateObjectDocument">
						<Parameter	Name="Document"			Direction="In"		Value="${Document}" />
						<Parameter	Name="DomainObject"		Direction="In"		Value="${Job}" />
						<Parameter	Name="ObjectDocument"	Direction="Out"							OutputProperty="${ObjectDocument}" />
					</Command>

					<ChangeStatus Name="Change Status" DomainObject="${Document}" NewStatus="${DocumentStatus}" />

					<Validation Name="ValidateIfAttachWasSuccessful" Condition="${AttachSuccessful} == True" MessageCode="2248">
						<Parameter	Name="ActualValue"	Direction="In"		Value="${DocumentPropertyName}" />
						<Parameter	Name="EntityName"	Direction="In"		Value="${DomainObject.EntityName}" />
						<Parameter	Name="PropertyName"	Direction="In"		Value="DocumentPropertyName" />
						<Parameter	Name="ValidValues"	Direction="In"		Value="${ValidPropertyNames}" />
					</Validation>

					<When Name="if message is not empty" Condition="${Message} != Empty">
						<Assign Name="add comma" Property="${Message}" Value="=#concat(${Message}, ', ')" />
					</When>

					<Assign Name="set message" Property="${Message}" Value="=#concat(${Message}, ${Document.FileName})" />
				</ForEach>

				<When Name="SetProgressStatusToResponseReceived" Condition="${SetProgressStatusToResponseReceived} == True">
					<WorkflowCall Name="Job_SetResponseReceivedProgressStatus" WorkflowName="Job_SetResponseReceivedProgressStatus">
						<Parameter	Name="Description"	Direction="In"		Value="${Message}" />
						<Parameter	Name="Job"			Direction="In"		Value="${Job}" />
					</WorkflowCall>
				</When>
			</Transaction>
		</When>

		<UserContent Name="Post" />

		<When Name="a Follow up job" Condition="${FollowUpJob} != Empty">
			<Message Name="Parent job already there" MessageCode="2698">
				<Parameter	Name="Job"	Direction="In"		Value="${Job}" />
			</Message>

			<View Name="OpenScreen" ViewName="DataEntryScreen">
				<Parameter	Name="DomainObject"	Direction="In"		Value="${FollowUpJob}" />
				<Parameter	Name="ScreenName"	Direction="In"		Value="${ScreenName}" />
			</View>
		</When>
	</Execution>
</Workflow>