Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

Delete related records from a table

Mishu
Tera Expert

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.

 

 

 

 

1 ACCEPTED SOLUTION

BharathChintala
Mega Sage

@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();

}

 

 

If my inputs have helped with your question, please mark my answer as accepted solution, and give a thumb up.
Bharath Chintala

View solution in original post

1 REPLY 1

BharathChintala
Mega Sage

@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();

}

 

 

If my inputs have helped with your question, please mark my answer as accepted solution, and give a thumb up.
Bharath Chintala