Business rule vs scheduled job

ryadavalli
Tera Expert

We have a requirement to update a flag x on the user record depending on the value on another field y.

We have 3 options:

1) Write a after BR which executes when the record is updated or inserted and update the flag x depending on y flag - Will get called with every update

2) Scheduled job (nightly) which will run right after the the user records are transformed and get all the records where field y is changed and set the flag x.

3) Write an on After transform script - This might delay the transform

Performance wise which one is better, thoughts ?

Thanks,

1 ACCEPTED SOLUTION

What you propose is perfectly do-able in the transform map script. You don't need an additional business rule. That's just overhead that can slow down your import.



target.x is available because it's part of sys_user. source.x is what came in from the import.



if (source.x == '1' || source.x == '2' || source.x == '3') {


        target.y = true;


} else {


        target.y = false;


}



Something like that sounds like a simple approach to what you described. Just make sure "Y" isn't in the field mapping.


View solution in original post

17 REPLIES 17

Yes X and Y are both fields of the sys_user table.


X is the title, Y is a flag. The idea is if X changes to 1, 2 or 3, flag needs to be set to true value.


since both are part of same transform map, i am not sure if target.x will be available as it is not committed to the DB yet.


I may have to look for BR or scheduled job route ?


What you propose is perfectly do-able in the transform map script. You don't need an additional business rule. That's just overhead that can slow down your import.



target.x is available because it's part of sys_user. source.x is what came in from the import.



if (source.x == '1' || source.x == '2' || source.x == '3') {


        target.y = true;


} else {


        target.y = false;


}



Something like that sounds like a simple approach to what you described. Just make sure "Y" isn't in the field mapping.


Yup, I thought of that way, but I need to have more conditions to check as there could be many values in the source which can translate to the value of X. Thats why I wanted to see I can do it alternatively. But if thats the only way for now, I can go ahead and do it.


Thanks Chuck !