weblike wroteI think this is a bug.
It is not a bug, it is a java feature :lol:
A lot of java functions return null if any of the parameters are null. I suspect that is what is happening here.
One solution is:
change your rules to
If Messages.HTML CONTAINS '{CustomerLastName}' Then
Messages.HTML=REPLACE_PATTERN(Messages.HTML,'\{CustomerLastName\}',(Messages.Owner.Customer_LastName+'~'))
which is adding ~ to the replacement value so any null attribute is no longer null.
Note: your can use any character besides ~ as long it is not used anywhere else in the message.
Then add the following rule to remove all of the ~
If Messages.HTML CONTAINS '~' Then
Messages.HTML=REPLACE_PATTERN(Messages.HTML,'~','')