How to trigger a business rule when ever new record created in referenced table
This content was last updated in 2021. It may still be useful, but could contain outdated information. Please confirm its accuracy before relying on it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-30-2021 08:06 AM
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.
- Labels:
-
Project Portfolio Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-30-2021 08:31 AM
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!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-30-2021 08:32 AM
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();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-30-2021 02:13 PM
Please enable Insert check box in the business rule. The script will triggers once record is inserted in the table.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-30-2021 05:28 PM
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.