The CreatorCon Call for Content is officially open! Get started here.

Email Notification List of All Changed Fields

H3ll0 Th3r3
Kilo Contributor

Hi Everyone!

I am hoping to get some advice on email notifications. I would like to have an email notification that is triggered on a change to fields in a form. I want the email to include a list of all the fields that were changed. There seems to be some info about this in the community, but it all seems to be out of date. Most solutions seem to involve creating a business rule and are somewhat confusing.

 

Thanks for your help in advance!

5 REPLIES 5

dvp
Mega Sage

Below script will return the list of field names that are updated

var changedFields = [];
	
		var fields = current.getFields();
		var field;
		for (var i = 0; i < fields.size(); i++) {
			field = fields.get(i);
			if (field.getName() == "variables")
				continue;
			if (field.changes()){
				changedFields.push(fields.get(i).getName());
			}
				
		}
			
gs.log(changedFields);

H3ll0 Th3r3
Kilo Contributor

Hi dvp!

 

Do I do that in an email script or a business rule?

You can do in either in business rule or email script

H3ll0 Th3r3
Kilo Contributor

If I were to do it in an email script, how would I add the list to the body of the email?