Before/After Insert/Update Business rule does not execute when no changes made to the record

Manikandan Subr
Kilo Guru

Hi, I have a Business rule which takes all the values from a column of an attached excel file and updates the values in a List field.

When i attach an excel attachment and if i dont make any changes to the record, it is not considering the attachment as an update to the record and hence the Business rule is not executing.

I have tried creating a client script to make an update on some field but i would need to have that field on the form. which is not what i want to do.

I have also tried creating a Business rule with a lower order to update some field but even that is not working.

Please suggest

4 REPLIES 4

sachin_namjoshi
Kilo Patron
Kilo Patron

This is expected behavior.

If there are no changes in records, then BR won't trigger.

When you attach an attachment, record is created in sys_attachment table.

You need to configure business rule on sys_attachment table with your table condition.

 

Regards,

Sachin

 

 

After attaching the attachment, the field in Change request table needs to be updated. As there is no changes to the change request record, it is not executing the business rule. Even i tried to update Change request table from BEFORE/INSERT Business rule of sys_attachment table. still same issue. 

 

var cr = new GlideRecord('change_request');
cr.addQuery('sys_id',current.table_sys_id);
cr.query();
while(cr.next()){
cr.u_to_be_update_cr = u_to_be_update_cr+'.';
} cr.update();

As per your question, u_to_be_update_cr is a LIST field. correct?

If it's list field, then you will need to update code like below

The key point to note is that for a GlideList you need to build up a string of sys_ids.

 

(function executeRule(current, previous /*null when async*/) {




   var feature = new GlideRecord('u_product_feature');


   feature.addQuery('u_product',current.u_product);


   feature.query();



   var featureIds = '';


   while (feature.next()) {


   featureIds += feature.sys_id + ',';


   }


   current.u_feature = featureIds;




})(current, previous);

 

Regards,

Sachin

puneetgoels1
Tera Guru

Check the table on which Business rule is. If you want it to execute for attachment, table name should be sys_attachment