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

ActionField1729

Beschrijving: Mail purchase to selected receiver. Custom: Nee

Propertiesbewerken

Property Type Accessor
Purchase Purchase Root
EmailAttachmentNameLabel String Optional
EmailTemplateCode UltimoString Optional
EmailTemplateCodeEmployee UltimoString Optional
EmailTemplateCodeVendorContacts UltimoString Optional
EmployeeContext Context Optional
EmployeeSqlFilter String Optional
FormName UltimoString Optional
GotoMailScreen Boolean Optional
ShowEmployee Boolean Optional
ShowVendor Boolean Optional
ShowVendorContact Boolean Optional
TitleCode String Optional

XMLbewerken

<Workflow Name="ActionField1729" Version="2025.07.28" WorkflowType="Standard" xmlns="urn:Ultimo.Framework.Workflow-mapping">
	<Security EditLevel="10" ViewLevel="20" UserContentLevel="30" />
	<Description>Mail purchase to selected receiver.</Description>
	<Properties>
		<Property	Name="Purchase"							Type="Purchase"				Accessor="Root"		Direction="In" />

		<Property	Name="EmailAttachmentNameLabel"			Type="String"				Accessor="Optional"	Direction="In"		Default="#label(PURCHASE_ORDERFORM)"												Comment="Name for PDF attached to Email" />
		<Property	Name="EmailTemplateCode"				Type="UltimoString"			Accessor="Optional"	Direction="In"		Default="00000000087"																Comment="Use this email template for email to vendor" />
		<Property	Name="EmailTemplateCodeEmployee"		Type="UltimoString"			Accessor="Optional"	Direction="In"		Default="00000000089"																Comment="Use this email template for email to employee" />
		<Property	Name="EmailTemplateCodeVendorContacts"	Type="UltimoString"			Accessor="Optional"	Direction="In"		Default="00000000088"																Comment="Use this email template for email to vendorcontacts" />
		<Property	Name="EmployeeContext"					Type="Context"				Accessor="Optional"	Direction="In"		Default="EmployeeContext.Standard"													Comment="Used in dialog title" />
		<Property	Name="EmployeeSqlFilter"				Type="String"				Accessor="Optional"	Direction="In"		Default="EmpRecStatus &gt;= 0 AND EmpContext IN(1) AND EmpEmailAddress is not null"	Comment="Use this filter for selecting internal employees" />
		<Property	Name="FormName"							Type="UltimoString"			Accessor="Optional"	Direction="In"		Default="Eml01"																		Comment="Not used anymore. Removed from Workflow call - #0759189" />
		<Property	Name="GotoMailScreen"					Type="Boolean"				Accessor="Optional"	Direction="In"		Default="True"																		Comment="Open the screen with the created Email" />
		<Property	Name="ShowEmployee"						Type="Boolean"				Accessor="Optional"	Direction="In"		Default="True"																		Comment="Show send email to employee in dialog" />
		<Property	Name="ShowVendor"						Type="Boolean"				Accessor="Optional"	Direction="In"		Default="True"																		Comment="Show send email to vendor in dialog" />
		<Property	Name="ShowVendorContact"				Type="Boolean"				Accessor="Optional"	Direction="In"		Default="True"																		Comment="Show send email to contact of vendor in dialog" />
		<Property	Name="TitleCode"						Type="String"				Accessor="Optional"	Direction="In"		Default="CHOOSEVENDORCONTACTS"														Comment="Labelcode for the dialog vendorcontacts" />

		<Property	Name="BCCEmailsString"					Type="String"				Accessor="Internal"						Default="Empty" />
		<Property	Name="Email"							Type="Email"				Accessor="Internal" />
		<Property	Name="EmailAttachmentName"				Type="String"				Accessor="Internal" />
		<Property	Name="Employee"							Type="Employee"				Accessor="Internal" />
		<Property	Name="EmployeeForEmail"					Type="Employee"				Accessor="Internal"						Default="Empty" />
		<Property	Name="Purchases"						Type="List[Purchase]"		Accessor="Internal" />
		<Property	Name="Receiver"							Type="Int32"				Accessor="Internal"						Default="0" />
		<Property	Name="ReceiverEntity"					Type="DomainObject"			Accessor="Internal" />
		<Property	Name="ReportData"						Type="ReportData"			Accessor="Internal" />
		<Property	Name="SelectedVendorContacts"			Type="List[Employee]"		Accessor="Internal" />
		<Property	Name="SetToEmailAddressEmpty"			Type="Boolean"				Accessor="Internal"						Default="False"																		Comment="Put the main email address in the bcc when an email is sent to multiple recipient (privacy)" />
		<Property	Name="ToEmailString"					Type="String"				Accessor="Internal"						Default="Empty" />
		<Property	Name="VendorContacts"					Type="List[Employee]"		Accessor="Internal" />
		<Property	Name="VendorContactsCount"				Type="Int64"				Accessor="Internal" />
		<Property	Name="VendorObjectContacts"				Type="List[ObjectContact]"	Accessor="Internal" />
	</Properties>
	<Execution>
		<UserContent Name="Pre" />

		<Choose Name="Check Show properties">
			<When Name="Vendor" Condition="${ShowVendorContact} == False &amp;&amp; ${ShowVendor} == True &amp;&amp; ${ShowEmployee} == False">
				<Assign Name="Receiver" Property="${Receiver}" Value="1" />
			</When>


			<When Name="VendorContact" Condition="${ShowVendorContact} == True &amp;&amp; ${ShowVendor} == False &amp;&amp; ${ShowEmployee} == False">
				<Assign Name="Receiver" Property="${Receiver}" Value="2" />
			</When>


			<When Name="Internal" Condition="${ShowVendorContact} == False &amp;&amp; ${ShowVendor} == False &amp;&amp; ${ShowEmployee} == True">
				<Assign Name="Receiver" Property="${Receiver}" Value="3" />
			</When>
		</Choose>

		<When Name="More then one Option" Condition="${Receiver} == 0">
			<Assign Name="Set Receiver 1" Property="${Receiver}" Value="1" />

			<When Name="Set Receiver" Condition="!${ShowVendor} &amp;&amp; ${ShowEmployee}">
				<Assign Name="Set Receiver 3" Property="${Receiver}" Value="3" />
			</When>

			<Dialog Name="SelectReceiver" TitleCode="SendEmail">
				<Container TitleCode="SelectReceiver" Border="True">
					<RadioGroup Name="Receiver" Width="425" Value="${Receiver}" OutputProperty="${Receiver}">
						<Item Description="VENDORCODE" Value="1" ReadOnly="=!${ShowVendor} || ${Purchase.Vendor} == Empty" Visible="=${ShowVendor} &amp;&amp; ${Purchase.Vendor} != Empty" />
						<Item Description="CONTACTPERSONOFVENDOR" Value="2" ReadOnly="=!${ShowVendorContact} || ${Purchase.Vendor} == Empty" Visible="=${ShowVendorContact} &amp;&amp; ${Purchase.Vendor} != Empty" />
						<Item Description="EMPLOYEE" Value="3" ReadOnly="=!${ShowEmployee}" Visible="=${ShowEmployee}" />
					</RadioGroup>
				</Container>
				<Container>
					<SelectionList Name="SelectedEmployee" Width="425" Visible="=${Receiver}==3 &amp;&amp; ${ShowEmployee}==true" Value="${Employee}" OutputProperty="${Employee}" ColumnName="EmpId" ViewfieldConfiguration="CONTACTPERSOON" Required="True" ReadOnly="=${Receiver}!=3 &amp;&amp; ${ShowEmployee} == True" LabelCode="SELECTEMPLOYEE" SqlWhereClause="${EmployeeSqlFilter}" />
				</Container>
			</Dialog>
		</When>

		<Choose Name="CheckEmailAddress">
			<When Name="Vendor" Condition="${Receiver} == 1">
				<Validation Name="ValidateVendorEmailAddress" Condition="${Purchase.Vendor.EmailAddress} != Empty" MessageCode="1120">
					<Parameter	Name="Vendor"	Direction="In"		Value="${Purchase.Vendor}" />
				</Validation>
				<Assign Name="ReceiverEntity" Property="${ReceiverEntity}" Value="${Purchase.Vendor}" />
			</When>


			<When Name="VendorContact" Condition="${Receiver} == 2">
				<Transaction>
					<GetCount Name="Count VendorContacts" Type="ObjectContact" OutputProperty="${VendorContactsCount}">
						<Filters>
							<PropertyFilter	PropertyName="Vendor"	Operator="="		PropertyValue="${Purchase.Vendor}" />
							<PropertyFilter	PropertyName="Context"	Operator="="		PropertyValue="ObjectContactContext.Standard" />
						</Filters>
					</GetCount>

					<Validation Name="ValidateVendorContacts" Condition="${VendorContactsCount} &gt; 0" MessageCode="3469">
						<Parameter	Name="Vendor"	Direction="In"		Value="${Purchase.Vendor}" />
					</Validation>

					<GetList Name="Get ObjectContacts" Type="ObjectContact" OutputProperty="${VendorObjectContacts}" OrderBy="Id" OrderDirection="Ascending">
						<Joins>
							<Join	Name="Employee"	Alias="emp"	Type="InnerJoin"		Comment="Only used to prefetch Employee" />
						</Joins>
						<Filters>
							<PropertyFilter	PropertyName="Vendor"	Operator="="		PropertyValue="${Purchase.Vendor}" />
							<PropertyFilter	PropertyName="Context"	Operator="="		PropertyValue="ObjectContactContext.Standard" />
							<NotFilter>
								<PropertyEmptyFilter PropertyName="emp.EmailAddress" />
							</NotFilter>
						</Filters>
					</GetList>

					<Validation Name="ValidateVendorContactsEmail" Condition="${VendorObjectContacts.Count} &gt; 0" MessageCode="3471">
						<Parameter	Name="Vendor"	Direction="In"		Value="${Purchase.Vendor}" />
					</Validation>

					<ForEach Name="Foreach found ObjectContact" In="${VendorObjectContacts}" As="VendorObjectContact">
						<AddToList Name="VendorContacts" List="${VendorContacts}" Item="${VendorObjectContact.Employee}" />
					</ForEach>
				</Transaction>

				<WorkflowCall Name="Dialog_ChooseRecords" WorkflowName="Dialog_ChooseRecords">
					<Parameter	Name="ItemsSource"		Direction="In"		Value="${VendorContacts}" />
					<Parameter	Name="TitleCode"		Direction="In"		Value="${TitleCode}" />
					<Parameter	Name="ItemsSelected"	Direction="Out"									OutputProperty="${SelectedVendorContacts}" />
				</WorkflowCall>

				<Assign Name="SetToEmailAddressEmpty" Property="${SetToEmailAddressEmpty}" Value="True" />

				<ForEach Name="Loop SelectedVendorContacts" In="${SelectedVendorContacts}" As="VendorContact">
					<Assign Name="ReceiverEntity" Property="${ReceiverEntity}" Value="${VendorContact}" />

					<When Name="Add separator" Condition="${ToEmailString} != Empty">
						<Assign Name="Add separator" Property="${ToEmailString}" Value="=#concat(${ToEmailString}, ',')" />
					</When>

					<Assign Name="Add email" Property="${ToEmailString}" Value="=#concat(${ToEmailString}, ${VendorContact.EmailAddress})" />
				</ForEach>

				<When Name="One contact selected" Condition="${SelectedVendorContacts.Count} == 1">
					<Assign Name="Set VendorContact" Property="${EmployeeForEmail}" Value="${SelectedVendorContacts[0]}" />
				</When>

				<Assign Name="EmailTemplateCode" Property="${EmailTemplateCode}" Value="${EmailTemplateCodeVendorContacts}" />
			</When>


			<When Name="Internal" Condition="${Receiver} == 3">
				<Assign Name="ReceiverEntity" Property="${ReceiverEntity}" Value="${Employee}" />
				<Assign Name="EmailTemplateCode" Property="${EmailTemplateCode}" Value="${EmailTemplateCodeEmployee}" />
				<Assign Name="Set Employee" Property="${EmployeeForEmail}" Value="${Employee}" />
			</When>
		</Choose>

		<CreateReport Name="Report" ReportName="pchprint01-01" ReportType="Pdf" OutputProperty="${ReportData}" Comment="Concept Purchase Order">
			<ReportFormulaValue Name="F1" ColumnName="PchId" Operator="=" Value="${Purchase.Id}" ResultType="String" />
		</CreateReport>

		<Assign Name="Set EmailAttachmentName" Property="${EmailAttachmentName}" Value="=#concat(${Purchase.Id}, '-' , ${EmailAttachmentNameLabel})" />

		<AddToList Name="Add Purchase to list" List="${Purchases}" Item="${Purchase}" />

		<WorkflowCall Name="Purchase_SendEmail" WorkflowName="Purchase_SendEmail">
			<Parameter	Name="Attachment"				Direction="In"		Value="${ReportData}" />
			<Parameter	Name="AttachmentName"			Direction="In"		Value="${EmailAttachmentName}" />
			<Parameter	Name="BCCEmailString"			Direction="In"		Value="${BCCEmailsString}" />
			<Parameter	Name="EmailTemplateCode"		Direction="In"		Value="${EmailTemplateCode}" />
			<Parameter	Name="Employee"					Direction="In"		Value="${EmployeeForEmail}" />
			<Parameter	Name="GotoMailScreen"			Direction="In"		Value="${GotoMailScreen}" />
			<Parameter	Name="Purchase"					Direction="In"		Value="${Purchase}" />
			<Parameter	Name="ReceiverEntity"			Direction="In"		Value="${ReceiverEntity}" />
			<Parameter	Name="RelatedSubjects"			Direction="In"		Value="${Purchases}" />
			<Parameter	Name="SetToEmailAddressEmpty"	Direction="In"		Value="${SetToEmailAddressEmpty}" />
			<Parameter	Name="ToEmailString"			Direction="In"		Value="${ToEmailString}" />
		</WorkflowCall>

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