- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-07-2016 02:36 AM
Hello All,
I have a requirement to create a data source and using transform map , map the following fields with the target table.
Site Id
Site City
Site Country
Company
Region
Now, my concern is that "Site city and Site Company " are not directly in the target table "ABC". but they are present in the related list(company) of this table(ABC). So I am not able to map Site city and Site country with the target table.
So, how can I map source fields with the target table related list fields.
Thanks In advance!
Shruti Malaviya
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-07-2016 03:01 AM
Hi Shruti,
All the related lists are the individual tables in Service Now and there is no way of updating the fields information directly from the transform map for the target table.
If you want to use only one transform map, then the transform scripts should be defined to glide into all the related list tables and update the information. We can do it by using some common code ( function call) for update of the information. Add an 'onAfter' script to your map.
The script can insert records into your related table. Simply set the reference field on the related record to the sys_id of the record that's been inserted by the transform map (target.sys_id).
Here's a very rough example that creates a new record in the Software instance table (cmdb_software_instance):
var sftInst = new GlideRecord('cmdb_software_instance');
sftInst.software = source.softwareName;
sfInst.installed_on = target.sys_id;
sfInst.insert();
The other solution to keep it simple, define multiple transform maps, one for each target table(related list).
Mark Correct if it solved your issue or hit Like and Helpful if you find my response worthy.
Thanks,
Deepa
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-16-2022 06:17 AM