Creating unnecessary records in custom table

SumanthBabu
Tera Contributor

Hi Team,
When we are excuting PO Scheduled Job it is inserting and updating ABC table and also it is creating new records in XYZ table We don't want to create in that XYZ table records because those are unnecessary records and those records also creating with only number field and remain all fields are showing empty.
One BR is there which is just replacing the prefix of the number field. In Active transaction we came to know that this BR is creating issue

BR - After Insert/update
(function executeRule(current, previous /*null when async*/ ) {

var record = new GlideRecord('XYZ');
record.query();
while (record.next()) {
var num = record.getValue('number');

record.number = num.replace('ECPB', 'EWM');
record.po_number_integration_with_procurement = record.po_number_integration_with_procurement.toString().replace('ROCG', '');
record.po_number_integration_with_procurement = record.po_number_integration_with_procurement.toString().replace(/\s+/g, '');
record.setWorkflow(false); //Do not run business rules
record.autoSysFields(false); //Do not update system fields
record.update();
}

0 REPLIES 0