Unable to get previous value using BR

Karishma Dubey
Tera Expert

Hello,

I am trying to perform some actions based on new value and previous value of BU code field present on user table.

I created after(update on some field value change) BR on user table and writing below code. However I am getting blank value in logs. Please suggest.

 

if (current.u_sf_business_unit_code.changes()) {
var prevBU = previous.u_sf_business_unit_code;
var newBU = current.u_sf_business_unit_code;
gs.log('previous BU', prevBU);
gs.log('newBU ', newBU);
try {
gs.log('BU changes ');
sn_fd.FlowAPI.getRunner().subflow('global.sml_internal_mover__business_unit').inBackground().withInputs(inputs).run();

} catch (ex) {
var message1 = ex.getMessage();
gs.error(message);
}

}

11 REPLIES 11

Community Alums
Not applicable

Hi @Karishma Dubey ,

Generally,  "After" business rule with "Insert / Update" method to get new and old value of CI

SandeepDutta_0-1708416687229.jpeg

 

Also, 

SandeepDutta_1-1708416736959.png

 

 

 

Mark Manders
Mega Patron

What do your logs return when you make it a before BR?


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark

it is still returning me blank.

Anil Nemmikanti
Giga Guru

Hi,

Previous object (As the database updation is already done) will not be available for After update BR. Please try doing validations with Before Update BR.