map the fields present in child table thrgh transform script if the transform map is on parent table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2023 03:58 AM
Hi,
I have a requirement where the transform map runs on network gear table, and there are two fields " hardware os" & "hardware version", which are in IP Firewall table only, which is the child table of network gear table.
I need to map these two values in child table coming through through transform map.
whenever the class is firewall the record gets created in ip firewall table through transform map, how can i map these two fields in child table through transform scripts when ever the record comes for firewall.
Is there any other way also to map these fields?
Kindly, assist!
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2023 06:44 AM
You can write an onAfter() transform script to map the target record values with the IP Firewall table fields.
For more information - https://docs.servicenow.com/bundle/tokyo-platform-administration/page/script/server-scripting/refere...
If I could help you with my response you can mark it as helpful and correct as it benefits future viewers
Thanks,
Sai Kumar B
Community Rising Star 2023 & 2022
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-01-2023 03:42 AM
hi,
i wrote below code in onafter transform script, it is working but it is alo creating one extra empty record in ip firewall table also, which should not happen.
if ((source.u_device_type == "Firewall") && (source.u_hardware_os != '' || source.hardware_os_version != ''))
{
var gr = new GlideRecord('cmdb_ci_ip_firewall');
gr.get(target.sys_id);
gr.setValue('har_os', source.u_hardware_os);
gr.setValue('os_version', source.u_hardware_os_version);
gr.update();
could you plsese suggest how to fix it?
Thanks!