- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-09-2020 02:10 PM
Hey All,
Does any one has an idea of how to use onForeignInsert() Event in Transform Map?
Scenario: I am trying to run a transform map on table which has a a user field in it. Now if the user is not in the sys_user table then it has to be created during load.
I have created a Field Map against the Ref field ( with Reference value name as "name") however using ForeignInsert Script to update email id
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2020 09:51 AM
Thanks Himanshu. Yes i sorted this out and used onAfter() function.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-09-2020 02:23 PM
Hi Anubhav,
You can set choice action to create records in the reference table.
- Pradeep Sharma
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-09-2020 06:24 PM
Hi Pradeep,
Thanks. I am just doing that.
However the email id of the user is not populated in user table due to which I have to use Transform Map Script or onForeignInsert() function.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-09-2020 07:37 PM
In onForeignInsert() function I am trying the following code:
target.<target_table_userrecord_fieldname>.email = source.<email_fieldname>

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-09-2020 09:22 PM
Hi Anubhav,
The onForeignInsert event script is processed at the start of the creation of a related, referenced record, before the record is created please refer below code to understand how to use this event.
var e = new GlideEvent("myimport_ForeignInsert", action, name, "");
e.insert();
Mark ✅ Correct if my answer solves your issue and also mark 👍 Helpful if you find my response worthy.
Thanks & Regards
Himanshu Dubey