I'm trying to create an audit log to track changes made to any field in a form. It's set to work on Validation on form submission. I've tried using the trusty old ChatGPT but it's getting confused too!
Can anyone point me in the right direction please? I'm getting an error on line 8, improper statement error might be due to missing ; at end of line or incomplete expression.
// Get the ID of the current record
recordID = input.ID;
// Get the list of fields in the form
fieldsToTrack = getFieldNames();
// Loop through the fields to track
for each field in fieldsToTrack
{
// Get old and new values
oldValue = ifnull(old.get(field), "");
newValue = ifnull(input.get(field), "");
// Check if the value has changed
if (oldValue != newValue)
{
// Add a new entry to the Activity log form
logEntry = insert into Activity
[
Date_Time = zoho.currenttime,
Field_Name = field,
Old_Value = oldValue.toString(),
New_Value = newValue.toString(),
User = zoho.loginuser,
Record_ID = recordID
];
}
}