- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2022 04:02 AM
BR to Create a new record in child table based on a field in parent table?
Thanks in Advance.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2022 04:08 AM
Hello ,
yes you can do it though a after update BR on parent table
where you condition can be like state changes (Example)
You can specify your condition and in script you can insert a record in child table
var gr = new GlideRecord('your_child_table_name');
gr.initialize();
gr.field_holding_parent_record = current.sys_id;
gr.insert();
Some thing like this you can do
Hope this helps
Mark my answer correct if this helps you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2022 04:11 AM
Hi,
Refer refer below links so you can do it with the Business rule with the conditions as per your business.
https://community.servicenow.com/community?id=community_question&sys_id=b48943a5db5cdbc01dcaf3231f9619aa
https://community.servicenow.com/community?id=community_question&sys_id=7f805369dbdcdbc01dcaf3231f9619c9
Thanks,
Pavankumar
ServiceNow Community MVP 2024.
Thanks,
Pavankumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2022 04:22 AM
Hi,
You can use if condition it will run only once
after your query add something like below
var inc= new GlideRecord('table_name');
inc.addQuery(); //add your query here
if (inc.next())
{
inc.initialize();
inc.parent_incident = current.sys_id;
inc.category = current.category;
inc.insert();
}
Thanks,
Pavankumar
ServiceNow Community MVP 2024.
Thanks,
Pavankumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2022 04:27 AM
Hi,
it should be simple enough
BR: After update on Parent Table
Condition: Your Field Changes
Script:
// create record into child table
What did you start and what's not working?
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2022 10:47 AM
You can use after insert BR on parent table
write code
var gr=new GlideRecord('child_table')
if(gr.next()){
gr.initialize()
gr.category=current.category;
gr.insert()
}
If it is helpful then click on helpful
Thanks & regards,
Urmila Mane