Specifying what changed in a record in an email notification

BenBl
New Member

Hey all,

I have an email notification sent every time a record is changed. This is great. But I would like to highlight, bold, or announce the column that was changed. E.g. if I have the columns orderid, status, product, and a user changes the product entry, I would like the notification to say โ€œUSEREMAIL() updated the product column from Product A to Product B at NOW()โ€. Now, in reality, I have 10 columns, some of which have child records.

My current approach is:

<<If: [_THISROW_BEFORE].[Status] <>[_THISROW].[Status]>> 
<<USEREMAIL()>> changed status from <<[_THISROW_BEFORE].[Status]>> to <<[_THISROW].[Status]>>
<<EndIf>>

The issue is: I donโ€™t want to copy and paste this for every column and I donโ€™t want to change it every time I update a column name or add a column.

Is there something built in to do this? (ideal) if not, is there a way to iterate through every column automatically?

1 4 542
4 REPLIES 4

No.

No. And I canโ€™t think of an easy way to loop through X number of Columns.

But you might be able to use List-Subtraction to get a list of values that are new.

LIST(
[_THISROW_AFTER].[Column1],
[_THISROW_AFTER].[Column2],
[_THISROW_AFTER].[Column3],...
)

-  

LIST(
[_THISROW_BEFORE].[Column1],
[_THISROW_BEFORE].[Column2],
[_THISROW_BEFORE].[Column3],...
)

This would result in a list of the new values only-- without the associated column name.

So itโ€™s only going to be useful if you can make it obvious which column those values are from.

I know thatโ€™s not ideal. But itโ€™s the simplest solution I can think of to easily see what changed.


Another option would be to just include a table with the full list of before and after values, side-by-side.

Then if you really want to get creative, you could try to format the values in the After list that are not in the before list.

That could work! Could you offer syntax or advice on this approach? I know how to print column by column, but how does one print a full row? How does one compare a full before row to a full after row and format on differences?

There isnโ€™t a way to print a full row with a single expression. You would have to list out each column name, with the before and after values each in their own expression.

Column Before After
Col1 <<[_THISROW_BEFORE].[Col1]>> <<[_THISROW_AFTER].[Col1]>>
Col2 <<[_THISROW_BEFORE].[Col2]>> <<[_THISROW_AFTER].[Col2]>>

Then, if you want the after value to be red when the value has changed, you could replace the after column with IF() statements.

<<IF(
[_THISROW_BEFORE].[Col1] <> [_THISROW_AFTER].[Col1],

[_THISROW_AFTER].[Col1],   <<-format this part RED in the template

[_THISROW_AFTER].[Col1]
)>>

The expression returns the same data in either case, but you can format each one differently.

This table format in a google doc works FABULOUSLY and simply. Thank you!

Top Labels in this Space