How to create a log for the field, not using "Audit Tra

Posted by Rollbase User on 20-Jul-2013 13:11

Hi, I need to create a log for the field (text). I prefer not to use "Audit Trail" but to have a separate text filed ("remarks_log") that will maintain list of present and previous values from other text filed ("remarks"). So far I created trigger on update "remarks" and use following formula based on Pavel example: var x = rbv_api.getFieldValue("shipment", {!id}, "remarks"); rbv_api.setFieldValue("shipment", {!id}, "remarks_log", x); var y = rbv_api.getFieldValue("shipment", {!id}, "remarks_log"); rbv_api.println("remarks="+x+", remarks_log="+y); Now, this formula is just copying value instead of adding it to existing values. Any ideas how to accomplish it? P.S. Idealy I need to put time stamp on each newly added record together with User ID

All Replies

Posted by Admin on 23-Jul-2013 09:41

Hi Roman,

In the code provided above, you're correct in describing that it is copying when instead you'd like the trigger to add the new "Remark" to the "Remarks Log".

One simple solution to add the "Remark" field to the "Remarks Log" field is to simply retrieve both the "Remarks Log" and "Remarks" field, append them, and assign the "Remarks Log" to copy the updated text. Here is the trigger I've created:

/*Retrieve the value of the Remarks field.*/

var newRemark = rbv_api.getFieldValue("shipment", {!id}, "remarks");

/*Retrieve the value of the Remarks Log field.*/

var currentLog = rbv_api.getFieldValue("shipment", {!id}, "remarks_log");

/*Use the Rollbase API to add a date to the resulting string. Do not include y since it is initially empty.*/

resultString = rbv_api.getCurrentDate() + " - " + newRemark;

/*Append y, Remarks Log, to the resulting.*/

if (currentLog != null)


resultString += "\n" + currentLog;


/*Set the Remarks Log field to the resulting string.*/


Posted by Admin on 24-Jul-2013 12:27


Appreciate your help!

Problem is that this trigger only works when field is updated manually, but when I'm doing mass update of existing records by importing data from csv file, data is not being copied to "Remarks Log".

At the same trigger does WORK on mass-creation of new records.

My Trigger Timing is active on "After Create" and "After Update".

Please assist.

Posted by Admin on 24-Jul-2013 12:42

Hello Roman,

if possible, could you please provide me with a sample CSV? I would like to replicate and create a solution according to the specific case. I assumed that the "Update Trigger" event would be thrown even when an object's field is updated from a CSV file.


Corey Prak

Posted by Admin on 24-Jul-2013 13:17

Here is link:

Posted by Admin on 25-Jul-2013 06:55

Hi Roman,

could you please let me know of the Import Mode that is selected upon updating the records via a CSV file is "Normal"? If so, I've been able to replicate the issue. The custom trigger with active Trigger Timings on "After Create" and "After Update" should definitely run upon importing a CSV file.

While I have confirmed that an issue is present, I would like to determine whether the behavior is consistent by modifying different values of the Import options. A Defect Report will still be made, but this may help in better understanding the issue and creating a more precise report.


Corey Prak

Posted by Admin on 25-Jul-2013 11:37


I have confirmed that the Trigger is not activated when importing records from XLS/CSV files with settings other than those described for our specific case. A Defect Report, CR# PSC00110925, has been created.

I will be sure to keep you updated on any developments as our product management team reviews this report. Please reply with any othe questions or concerns you may have.


Corey Prak

This thread is closed