Business Rule: Current and Previous are coming up empty

MichaelP
Tera Contributor

Trying to set up a BR on the user table that cycles through a few fields to check if they changed in order to call an event. As a test, I set up the array with 3 values. Sample Before BR below:


-----------------------------------------------------------------------------------------------------------------------

(function executeRule(current, previous /*null when async*/) {
 
var changeFields = [department, title, x_nuvo_eam_primary_location];
for(var i=0; i<changeFields.length; i++)
{
//check if field value has changed or is updated on user record
if(current.getValue(changeFields[i]) != previous.getValue(changeFields[i]))
{
gs.eventQueue('x_nuvo_eam.spaceRulesM2MRecordUpdated',current,current.sys_id);
}
 
})(current, previous);
-----------------------------------------------------------------------------------------------------------------------
When I log the values as they pass through, only the first value in the array gives the correct values for current and previous, all additional fields added after that have values listed as Null. This doesn't change when the fields change, only the first in the array give values back when I log this out. Any idea why this would be? They definitely have values from what I can see on the table. 

0 REPLIES 0