Logging Attribute Changes

To log individual attribute changes, you can take advantage of a connector's 'Compute Changes' feature (assuming you don't have 'Skip Lookup' enabled). Use the following hooks:

After Lookup

// Make a copy of the CONN object so we can reference the values later
var originalEntry = conn;


Before Applying Changes

// At this point in the assemblyline all the conn attributes have been removed except 
// for the ones that we are changing. 
// This allows us to iterate over just the new values while referencing the old version
// of them in the previous copy

task.logmsg("INFO","  Change Detected");

var connAttrNames = conn.getAttributeNames();

task.logmsg("INFO","  TIM attribute --replacing--> Other attribute"); 
for (connAttr in connAttrNames) {
                                                    
task.logmsg("INFO", "  " + connAttr + ": '" + conn.getAttribute(connAttr) + "' --> '" + originalEntry.getAttribute(connAttr) + "'");
}

Note:

Sometimes, the connector detects a change even when there appears to be no changes. This is the response from an IBM  PMR: 

"Note, I did find that the expected outcome may be different depending on the table datatype. For example, I set maildomain from the input to TDI and set to update the job attribute in the database. The job datatype is character of length 8, therefore that field was shown to update regardless. So, you may have to manually manage padding. "
Comments