Unable to run business rule in scoped application

Sachin Gavhane
Giga Guru

I am writing BR on sys_attachment table [ After insert/ update]

 

Advanced:

 

    var variablesysid = current.table_sys_id;
    var fileName= current.file_name;
    var attachmentid= current.sys_id;
    var gr = new GlideRecord('item_option_new');
gr.addQuery('sys_id',variablesysid);
gr.query();
if(gr.next()){
    gs.info("inbr if loop999");
    var a = '<p><img src="/sys_attachment.do?sys_id='+ attachmentid +'"/></p>';
    gr.rich_text = a;
   
    gr.update();
}

})(current, previous);
 
 
____________________________________________________________________________________________________________
I have given cross scope application access to both sys_attachment and item_option_new tables. Still not able to run the BR in scoped app.
 
can someone help
2 REPLIES 2

Anil Lande
Kilo Patron

Hi,

Did you check adding logs in the beginning of BR to test if it is running or not.

Also As per your condition the BR will be triggered once an attachment record is created/update. 

Can you please explain how record is created/updated and why it is updating Variable definition from table 'item_option_new'?

I hope you are adding attachment on Variable to test this BR.

 

Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Thanks
Anil Lande

Anil Lande
Kilo Patron

Hi @Sachin Gavhane 

I tested your scope and I was able to the result.

1. Create a Variable of type Rich text in scope app. And added temp Rich text.

2. Created a BR and added your script.

3. Added attachment on The variable created in step1

It shows the added attachment in the Rich Text field on Variable.

 

Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Thanks
Anil Lande