- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2018 09:35 AM
Create a business rule 'Remove Temp Incident Rule' , This should execute only whenever any record removed from 'Incident' table.
- Query the incident number from 'incident_temp' table based on removed Incident Number record from 'Incident' table
- Remove the corresponding incident record from 'Incident_temp' table
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2018 11:33 AM
Advanced checkbox should be checked.
When to Run - before and delete checkbox should be checked.
Code will be this -
var gr = new GlideRecord('incident_temp');
gr.addQuery('field_name', current.number);
gr.query();
if(gr.next()) {
gr.deleteRecord();
}
For Full Detail of Business Rules go through the below link -

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2018 11:26 AM
Create a business rule on the Incident Table, click the Advanced checkbox. In the "When to Run" tab select Before in the "When" dropdown and the Delete checkbox. This way the rule only runs when a record is deleted on the Incident table. You can also add more conditions in the "Filter Conditions" section towards the bottom.
In the advanced tab, add this code and change it as necessary to fit your needs:
var grIncidentTemp = new GlideRecord('incident_temp');
grIncidentTemp.addQuery('incident', current.sys_id); // Use whatever you named your Incident reference field as
grIncidentTemp.query();
if(grIncidentTemp.next()) {
grIncidentTemp.deleteRecord();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2018 11:32 AM
Thank you Dylan