The script here below lets you create a calculated string that automatic compute the shift in which the event has been created.
Create a business field of type Calculated string and paste and adapt the following code.
The most common parameters you would like to update are the starting dates of each shift as well as the shift name.
Powershell code
$ret = ""; #output variable initialization
$morningShiftStart = 5; #start hour of the morning shift
$afternoonShiftStart = 13; #start hour of the afternoon shift
$nightShiftStart = 21; #start hour of the night shift
$morningShiftText = 'Matin'; #name of the morning shift
$afternoonShiftText = 'Après-midi'; #name of the afternoon shift
$nightShiftText = 'Nuit'; #name of the night shift
<#extract the hour from the creation event date and extract the time
this might be adjusted depending of the date format of Shiftconnector tenant
#>
$time = $context.GetLocalDateTimeFormatted($context.EntryItem.CreationDateTime);
$hourInt = [int]$time.Substring(16,2);
if(($hourInt -ge $morningShiftStart) -and ($hourInt -lt $afternoonShiftStart)) {
$ret += $morningShiftText;
}elseIf(($hourInt -ge $afternoonShiftStart) -and ($hourInt -lt $nightShiftStart)) {
$ret += $afternoonShiftText;
}elseIf(($hourInt -ge $nightShiftStart) -or ($hourInt -lt $morningShiftStart)) {
$ret += $nightShiftText;
}
"$ret";
The best way to get IT support is to use the new
Service One Platform.