Hello,
Thank you for describing the workflow. For everything to work as you expect, you need to use the below script that will convert the date specified in the parameter according to time zones before saving to Adaxes custom attribute.
As for email notifications, you can use a value reference like %adm-CustomAttributeDate1,,,utc%
. In this case, it will resolve into the date stored in the attribute in UTC time zone.
$parameterName = "param-DateParam" # TODO: modify me
$timeZoneIdInitiator = "Eastern Standard Time" # TODO: modify me
$timeZoneIdTargetObject = "Pacific Standard Time" # TODO: modify me
# Convert datetime to initiator time zone
$dateTime = $Context.Arguments.GetParameterValueAsIs($parameterName)
try {
$initiatorDateTime = [System.TimeZoneInfo]::ConvertTimeBySystemTimeZoneId($dateTime, $timeZoneIdInitiator)
} catch {
$Context.LogMessage("Error: Time zone ID '$timeZoneIdInitiator' not found or invalid. Exception: " + $_.Exception.Message, "Error")
return
}
# Get TimeZoneInfo for target object
try {
$targetTimeZone = [System.TimeZoneInfo]::FindSystemTimeZoneById($timeZoneIdTargetObject)
} catch {
$Context.LogMessage("Error: Time zone ID '$timeZoneIdTargetObject' not found or invalid. Exception: " + $_.Exception.Message, "Error")
return
}
# Convert initiator datetime to target object time zone
$targetObjectDateTimeInUtc = [System.TimeZoneInfo]::ConvertTimeToUtc($initiatorDateTime, $targetTimeZone)
# Save date to custom attribute
$Context.TargetObject.Put("adm-CustomAttributeDate1", $targetObjectDateTimeInUtc)
$Context.TargetObject.SetInfo()
Thank you for the suggestion and provided details. We forwarded the lot to the corresponding department for consideration.