- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-31-2023 12:56 AM - edited 03-31-2023 01:47 AM
Hi,
I have a requirement if say Type 'A" record is created in a related table then at the same time another record of type "B" should be created and interlinked to the parent record in the same table. I have to make sure that if any of these 2 gets deleted then the other one should also be deleted.
Please advise.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-31-2023 01:26 AM
@Mishu write after business on related table
check on delete only
in script
var gr = new GlideRecord('related table');// replace table name inside quotes
gr.addQuery('parent', current.relatedticketnumber);// give backend names correctly for parent and relatedticknumber.
gr.query();
if(gr.next()){// if there is a chance that will have multiple records use while in if.
gr.deleteRecord();
}
Bharath Chintala
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-31-2023 01:26 AM
@Mishu write after business on related table
check on delete only
in script
var gr = new GlideRecord('related table');// replace table name inside quotes
gr.addQuery('parent', current.relatedticketnumber);// give backend names correctly for parent and relatedticknumber.
gr.query();
if(gr.next()){// if there is a chance that will have multiple records use while in if.
gr.deleteRecord();
}
Bharath Chintala