- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2016 10:07 AM
I'm trying to create request/requested item from an excel file and using a transform map to do this. I have an onBefore transform script with the cart info to add that item, however it creates duplicate records. I've tried with changing the Target table to sc_request and sc_req_item, but no luck. How can I avoid duplicates?
Here's my onBefore transform script:
(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
var cart = new Cart();
var item = cart.addItem('XXXXXX');//sysid of item
cart.setVariable(item,'uniqname_off', source.u_campus_id);
cart.setVariable(item, 'mgr_uniqname', source.u_campus_id__i_);
cart.setVariable(item, 'dept_id', source.u_dept_id);
cart.setVariable(item, 'dept_name', source.u_descr);
var rc = cart.placeOrder();
})(source, map, log, target);
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2016 01:49 PM
Ok I figured it out, I needed a ignore = true; at the end of the script.
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2016 10:50 AM
I have never used transform script for adding items to cart.. However you can use:
var cartId= GlideGuid.generate(null);
var cart = new Cart(cartId);
insead of :
var cart = new Cart();
in the transform script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2016 01:23 PM
I tried using what you suggested, and it's still creating a second requested item. Should the target table still be Requested Item?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2016 01:49 PM
Ok I figured it out, I needed a ignore = true; at the end of the script.
Thanks!