- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago - last edited 3 weeks ago
I have a transform to import records and after importing it generates extra records that are null: I have Onafter script
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
transform map is on which target table?
why you didn't write the logic in onBefore transform script to create REQ and RITM?
To ignore records getting created in target table and if your requirement is only to create REQ and RITM using Cart API then use this
Create onBefore Transform script
(function transformRow(source, target, map, log, isUpdate) {
ignore = true;
})(source, target, map, log, action === "insert");
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
transform map is on which target table?
why you didn't write the logic in onBefore transform script to create REQ and RITM?
To ignore records getting created in target table and if your requirement is only to create REQ and RITM using Cart API then use this
Create onBefore Transform script
(function transformRow(source, target, map, log, isUpdate) {
ignore = true;
})(source, target, map, log, action === "insert");
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hello @samadam ,
can you please wrap your code in a try-catch-block to see whether any code issue lead to that result:
(function transformRow(source, target, map, log, isUpdate) {
try {
var cart = new Cart(GlideGuid.generate(null));
var item = cart.addItem('e97b9be9877df110809aa9b60cbb1234');
cart.setVariable(item, 'short_description', 'TEST Request');
cart.setVariable(item, 'requested_for', '6582020a1b9744903aa6da49bc4bac1b');
cart.setVariable(item, 'what_is_being_requested','Other Service');
cart.setVariable(item, 'site_code', '9332a4431bc7d410bdaa6579bc4bcb83');
cart.setVariable(item, 'device', 'Workstaion');
cart.setVariable(item, 'customer_contact_number', '234-450-4412');
cart.setVariable(item, 'what_service_is_required', source.u_notes);
cart.setVariable(item, 'best_days', 'Monday - Friday 0800-1700');
cart.setVariable(item, 'name', 'details located in description');
cart.setVariable(item, 'assignment_group', '129c1a0c1b569890e403a93be54bc123');
var rc = cart.placeOrder();
}
catch (e) {
gs.error(e);
ignore = true;
}
})(source, target, map, log, action === "insert");
If my response helped mark as helpful and accept the solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
I have the transform map on RITM and added ignore=true and changed to OnBefore and it worked.
