How to trigger a business rule when ever new record created in referenced table

kkswamy
Tera Expert

Hi,

I have a Before - update business rule on project[pm_project] table which will calculate and update the one of my custom field "defect score" on the project, i put the trigger condition for this business rule, when project is closed but now i have a requirement that, this business rule should trigger whenever new defect is created a project after the project is closed,

May i know how to set this trigger condition for this business rule?

Any help much appreciated.

 

4 REPLIES 4

Allen Andreas
Administrator
Administrator

Hi,

The trigger itself has to be on record action, whether insert or update, so...you'd have to create a business rule on the defect table to do whatever you need to do elsewhere.

Please mark reply as Helpful/Correct, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

Harsh Vardhan
Giga Patron

You can write after "insert" business rule on defect table and there you can do the calculation part to update the field value on custom field .

 

eg:

 

var gr = new GlideRecord('pm_project');
gr.addQuery('sys_id',current.parent);
gr.query();
if(gr.next()){

gr.<field name> = current.<defect column value which you want to update>;
gr.update();
}

Chandrashekar t
Tera Guru

Please enable Insert check box in the business rule. The script will triggers once record is inserted in the table.

Harsh Vardhan
Giga Patron

Any update on this thread ?

Let me know if you need any further help here.

If your query has resolved, kindly select the correct answer and close this thread.