I am trying to create an alert that only goes off between 6AM and 6PM and am trying to create a pipeline to facilitate this.
I want to evaluate if the full message field contains the text “ACCUM_CLAIM_HOLD_PROD1” between 6AM and 6PM and if it does add the field “can_alert”.
The field gets added with the following code.
rule "Alert When Accumulation Service Stops"
when
has_field("full_message") AND to_bool(regex("ACCUM_CLAIM_HOLD_PROD1",to_string($message.full_message)).matches)
then
set_field("can_alert", true);
end
When I add on what I think is needed to evaluate the time I just get an error complaining about “Incompatible types”.
rule "Alert When Accumulation Service Stops"
when
has_field("full_message") AND to_bool(regex("ACCUM_CLAIM_HOLD_PROD1",to_string($message.full_message)).matches)AND (to_date($message.EventReceivedTime).hourOfDay >= 6 AND to_date($message.EventReceivedTime).hourOfDay <= 18)
then
set_field("can_alert", true);
end
I was hoping I could get some guidance on what I am missing.