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

With BR, every user record will be checked for the condition of the BR


Incorrect. A BR will be triggered by the record(s) that the user is amending.


if it is a scheduled job, it will run one time and get the result set and will work on it


It may run one time... but it will be amending several records in the result set.



Look at it logically: 10 users will create 10 updates, which will take place when they do submit/update/save... or you can store all of that work up and do the 10 updates in a scheduled job.   Both take the same work, the difference is if you want the slight performance overhead now, or you're interested in raw speed but currently inaccurate data.



What's preferable to your users? Speed or accuracy? And - have you done any time analysis to see what performance impact the BR brings?


We have a nightly import where the users will be modified (updated/inserted).


So when you said, accuracy, it will be same with a job and BR right, do you see any particular advantage with BR vs job in terms of best practices.



Scheduled job right after out import


BR with condition to trigger when field Y changes?



Thanks


Are you importing all users or just a difference?



If it's all users, then I recommend doing the script in a transform map as the records come in. Make the data clean and updated once at import.


Hi Chuck,



Thanks for your response. We get all the users, some will be updated, some skipped (if no updates). I thought of the transform field map as but if there any order in which field get updated, because field X (which I need to update) depends on field Y. Can I make sure Y is updated so that I check the value of Y like target.Y in the field map for X?



Thanks,


Performance wise what is effective, a transform field map or scheduled job or a business rule for the following scenario:


We get all the users, some will be updated, some skipped (if no updates). Field Y on the user table needs to be updated based on value of field X?


1) Transform field map,   but is there any order in which field get updated, because field Y (which I need to update) depends on field X


2) After BR which executes when the record is updated or inserted and update the field   Y depending on field X


3) Scheduled job (nightly) which will run right after the the user records are transformed and get all the records where field X is changed and set the value of Y