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

ActionField676

Beschrijving: Upload file and create ObjectDocument for DomainObject. Custom: Nee

Propertiesbewerken

Property Type Accessor
DomainObject DomainObject Root
AskForDocumentType Boolean Optional
AskForSite Boolean Optional
DocumentContext Context Optional
DocumentPropertyName String Optional
FileFilter String Optional
FileSystemPath FileSystemPath Optional

XMLbewerken

<Workflow Name="ActionField676" Version="2025.07.28" WorkflowType="Standard" xmlns="urn:Ultimo.Framework.Workflow-mapping">
	<Security EditLevel="10" ViewLevel="20" UserContentLevel="30" />
	<Description>Upload file and create ObjectDocument for DomainObject.</Description>
	<Properties>
		<Property	Name="DomainObject"			Type="DomainObject"		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"						Comment="Create Document with this context" />
		<Property	Name="DocumentPropertyName"	Type="String"			Accessor="Optional"	Direction="In"		Default="Document"										Comment="Link Document to this Property of the DomainObject" />
		<Property	Name="FileFilter"			Type="String"			Accessor="Optional"	Direction="In"																Comment="Select only files with this filter" />
		<Property	Name="FileSystemPath"		Type="FileSystemPath"	Accessor="Optional"	Direction="In"																Comment="Location of the files" />

		<Property	Name="AttachSuccessful"		Type="Boolean"			Accessor="Internal"						Default="False" />
		<Property	Name="Site"					Type="Site"				Accessor="Internal" />
		<Property	Name="SiteExists"			Type="Boolean"			Accessor="Internal"						Default="False" />
		<Property	Name="UploadedDocuments"	Type="List[Document]"	Accessor="Internal" />
		<Property	Name="ValidPropertyNames"	Type="String"			Accessor="Internal" />
	</Properties>
	<Execution>
		<UserContent Name="Pre" />

		<When Name="PmJob" Condition="${DomainObject.EntityName} == PmJob">
			<Validation Name="PmJob must have status Open" Condition="${DomainObject.Status} == PmJobStatus.Created" MessageCode="2371">
				<Parameter	Name="PmJob"	Direction="In"		Value="${DomainObject}" />
			</Validation>
		</When>

		<Transaction>
			<Command Name="Check if DomainObject has Site" CommandName="HasPropertyOrForeignKey">
				<Parameter	Name="EntityName"							Direction="In"		Value="${DomainObject.EntityName}" />
				<Parameter	Name="PropertyName"							Direction="In"		Value="Site" />
				<Parameter	Name="ThrowExceptionWhenPropertyNotValid"	Direction="In"		Value="False" />
				<Parameter	Name="PropertyExists"						Direction="Out"											OutputProperty="${SiteExists}" />
			</Command>
		</Transaction>

		<When Name="DomainObject has Site" Condition="${SiteExists} == True">
			<Assign Name="Set Site" Property="${Site}" Value="${DomainObject.Site}" />
		</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="MaximumNumberOfFiles"	Direction="In"		Value="1"																Comment="A document is attached to a DomainObject by registering it in a property, hence 1 document is the maximum." />
			<Parameter	Name="Site"					Direction="In"		Value="${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="${DomainObject}" />
					<Parameter	Name="PropertyName"			Direction="In"		Value="${DocumentPropertyName}" />
					<Parameter	Name="AttachSuccessful"		Direction="Out"										OutputProperty="${AttachSuccessful}" />
					<Parameter	Name="ValidPropertyNames"	Direction="Out"										OutputProperty="${ValidPropertyNames}" />
				</Command>

				<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>
			</ForEach>
		</Transaction>

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