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

ActionField1001

Beschrijving: Create a new ShiftLog for this ShiftLogbook and transfer open ShiftLogLines from previous ShiftLog if applicable. Custom: Nee

Propertiesbewerken

Property Type Accessor
ShiftLogbook ShiftLogbook Root

XMLbewerken

<Workflow Name="ActionField1001" Version="2025.07.28" WorkflowType="Standard" xmlns="urn:Ultimo.Framework.Workflow-mapping">
	<Security EditLevel="10" ViewLevel="20" UserContentLevel="30" />
	<Description>Create a new ShiftLog for this ShiftLogbook and transfer open ShiftLogLines from previous ShiftLog if applicable.</Description>
	<Properties>
		<Property	Name="ShiftLogbook"							Type="ShiftLogbook"			Accessor="Root"		Direction="In" />

		<Property	Name="CreatedShiftLog"						Type="ShiftLog"				Accessor="Internal" />
		<Property	Name="MaxShiftLogId"						Type="String"				Accessor="Internal" />
		<Property	Name="Now"									Type="DateTime"				Accessor="Internal"						Default="#{Environment.CurrentDateTime}" />
		<Property	Name="QueriedShiftLog"						Type="ShiftLog"				Accessor="Internal" />
		<Property	Name="QueryResultShiftLogbookWorkPeriod"	Type="QueryResult"			Accessor="Internal" />
		<Property	Name="SelectedShiftLogStartDate"			Type="Date"					Accessor="Internal" />
		<Property	Name="SelectedShiftLogStartWorkPeriod"		Type="WorkPeriod"			Accessor="Internal" />
		<Property	Name="SelectedShiftStartMoment"				Type="DateTime"				Accessor="Internal" />
		<Property	Name="TimeDifferenceInHours"				Type="Int16"				Accessor="Internal" />
		<Property	Name="WorkPeriodContext"					Type="Context"				Accessor="Internal" />
		<Property	Name="WorkPeriodIds"						Type="List[UltimoString]"	Accessor="Internal"																	Comment="to filter valid WorkPeriods" />
	</Properties>
	<Execution>
		<UserContent Name="Pre" />

		<Transaction>
			<GetMax Name="GetMaxShiftLogIdForThisShiftLogbook" Type="ShiftLog" OutputProperty="${MaxShiftLogId}" PropertyName="Id">
				<Filters>
					<PropertyFilter	PropertyName="ShiftLogbook"	Operator="="		PropertyValue="${ShiftLogbook}" />
				</Filters>
			</GetMax>

			<GetItem Name="GetItemLastShiftLog" Type="ShiftLog" OutputProperty="${QueriedShiftLog}" Comment="ShiftLog with maximum Id is the last one">
				<Filters>
					<PropertyFilter	PropertyName="Id"	Operator="="		PropertyValue="${MaxShiftLogId}" />
				</Filters>
			</GetItem>

			<Validation Name="ValidateStatusLastShiftLog" Condition="${QueriedShiftLog} == Empty || ${QueriedShiftLog.Status} == ShiftLogStatus.Closed" MessageCode="1935" />

			<WorkflowCall Name="ShiftLogbook_GetAllWorkPeriods" WorkflowName="ShiftLogbook_GetAllWorkPeriods">
				<Parameter	Name="ShiftLogbook"			Direction="In"		Value="${ShiftLogbook}" />
				<Parameter	Name="ValidationForCreate"	Direction="In"		Value="True" />
				<Parameter	Name="WorkPeriodIds"		Direction="Out"								OutputProperty="${WorkPeriodIds}" />
			</WorkflowCall>
		</Transaction>

		<Assign Name="Assign WorkPeriodContext" Property="${WorkPeriodContext}" Value="WorkPeriodContext.ShiftHandover" />

		<Dialog Name="CreateShiftLogDialog" TitleCode="CREATESHIFTLOG">
			<Container Border="True">
				<Date Name="SelectedShiftLogStartDate" Value="${SelectedShiftLogStartDate}" OutputProperty="${SelectedShiftLogStartDate}" Required="True" LabelCode="STARTDATE" />

				<ComboBox Name="SelectedShiftLogStartWorkPeriod" Value="${SelectedShiftLogStartWorkPeriod}" OutputProperty="${SelectedShiftLogStartWorkPeriod}" Required="True" LabelCode="WORKPERIOD" OrderDirection="Ascending" OrderBy="StartTime">
					<Filters>
						<InFilter PropertyName="Id" Values="${WorkPeriodIds}" />
						<PropertyFilter	PropertyName="Context"	Operator="="		PropertyValue="WorkPeriodContext.ShiftHandover" />
					</Filters>
				</ComboBox>
			</Container>
		</Dialog>

		<Transaction>
			<GetItem Name="GetItemShiftLogForSelectedStartDateAndStartWorkPeriod" Type="ShiftLog" OutputProperty="${QueriedShiftLog}" Comment="ShiftLog with selected StartDate and WorkPeriod">
				<Filters>
					<PropertyFilter	PropertyName="ShiftLogbook"	Operator="="		PropertyValue="${ShiftLogbook}" />
					<PropertyFilter	PropertyName="StartDate"	Operator="="		PropertyValue="${SelectedShiftLogStartDate}" />
					<PropertyFilter	PropertyName="WorkPeriod"	Operator="="		PropertyValue="${SelectedShiftLogStartWorkPeriod}" />
				</Filters>
			</GetItem>
		</Transaction>

		<Validation Name="ValidateSelectedWorkPeriodDoesNotExistAlready" Condition="${QueriedShiftLog} == Empty" MessageCode="1942" />

		<Assign Name="AssignSelectedShiftStartMoment" Property="${SelectedShiftStartMoment}" Value="=#setdatetime(#getyear(${SelectedShiftLogStartDate}), #getmonth(${SelectedShiftLogStartDate}), #getday(${SelectedShiftLogStartDate}), #gethours(${SelectedShiftLogStartWorkPeriod.StartTime}), #getminutes(${SelectedShiftLogStartWorkPeriod.StartTime}))" />
		<Assign Name="AssignTimeDifferenceInHours" Property="${TimeDifferenceInHours}" Value="=#getdatedifference('h', ${Now}, ${SelectedShiftStartMoment})" />

		<Choose Name="ChooseWhetherCurrentTimeIsBeforeOrAfterStartMoment">
			<When Name="WhenTimeDifferenceInHours" Condition="${TimeDifferenceInHours} &lt;= 0" Comment="Current time is after SelectedShiftStartMoment">
				<Validation Name="ValidateStartDate 1" Condition="(${TimeDifferenceInHours} * -1) &lt; #{UltimoSettings.MaxHoursAfterShiftStart}" MessageCode="1936">
					<Parameter	Name="MaxHoursAfter"	Direction="In"		Value="#{UltimoSettings.MaxHoursAfterShiftStart}" />
					<Parameter	Name="MaxHoursBefore"	Direction="In"		Value="#{UltimoSettings.MaxHoursBeforeShiftStart}" />
				</Validation>
			</When>

			<Otherwise Name="OtherwiseTimeDifferenceInHours" Comment="Current time is before SelectedShiftStartMoment">
				<Validation Name="ValidateStartDate 2" Condition="${TimeDifferenceInHours} &lt; #{UltimoSettings.MaxHoursBeforeShiftStart}" MessageCode="1936">
					<Parameter	Name="MaxHoursAfter"	Direction="In"		Value="#{UltimoSettings.MaxHoursAfterShiftStart}" />
					<Parameter	Name="MaxHoursBefore"	Direction="In"		Value="#{UltimoSettings.MaxHoursBeforeShiftStart}" />
				</Validation>
			</Otherwise>
		</Choose>

		<Transaction>
			<WorkflowCall Name="WorkflowCallShiftLogbook_CreateShiftLog" WorkflowName="ShiftLogbook_CreateShiftLog">
				<Parameter	Name="ShiftLogbook"				Direction="In"		Value="${ShiftLogbook}" />
				<Parameter	Name="ShiftLogStartDate"		Direction="In"		Value="${SelectedShiftLogStartDate}" />
				<Parameter	Name="ShiftLogStartWorkPeriod"	Direction="In"		Value="${SelectedShiftLogStartWorkPeriod}" />
				<Parameter	Name="CreatedShiftLog"			Direction="Out"													OutputProperty="${CreatedShiftLog}" />
			</WorkflowCall>

			<GetItem Name="GetItemPreviousShiftLogAgain" Type="ShiftLog" OutputProperty="${QueriedShiftLog}" Comment="MaxShiftLogId still has the Id of the previous ShiftLog">
				<Filters>
					<PropertyFilter	PropertyName="Id"	Operator="="		PropertyValue="${MaxShiftLogId}" />
				</Filters>
			</GetItem>

			<When Name="WhenPreviousShiftLogExists" Condition="${QueriedShiftLog} != Empty">
				<WorkflowCall Name="Call ShiftLog_ShiftOpenShiftLogLines" WorkflowName="ShiftLog_ShiftOpenShiftLogLines">
					<Parameter	Name="CreatedShiftLog"	Direction="In"		Value="${CreatedShiftLog}" />
					<Parameter	Name="ShiftLog"			Direction="In"		Value="${QueriedShiftLog}" />
				</WorkflowCall>
			</When>
		</Transaction>

		<UserContent Name="Post" />

		<View Name="OpenScreen" ViewName="DataEntryScreen">
			<Parameter	Name="DomainObject"			Direction="In"		Value="${CreatedShiftLog}" />
			<Parameter	Name="FocusEditableField"	Direction="In"		Value="=${CreatedShiftLog.Description} == Empty" />
		</View>
	</Execution>
</Workflow>