- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2023 01:57 PM
Hi guys,
I am trying to create new Service Catalog Request when I upload records from my import set. At any given time the import set can contain 50+ records and I need a record for each. I have created a Transform Script that will use API to populate data, however, I am not getting the desired results. Please take a look at my code and let me know if I am missing anything or if it is even possible.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2023 04:28 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2023 06:26 PM
Hi, a partial screenshot doesn't allow for much of a review\assessment.
What are the results of your debugging, is the transform script triggered, are your target fields populated as you expected? Perhaps add some logging\debugging so you can see what is\isn't happening, this will help you work through your problem.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2023 08:23 AM
Hello,
I have placed log statements into my code and can see them when I check the logs so I know that the transform script at least runs, however, I do not see any Service Catalog records getting created which is what I am trying to accomplish.
I have tried changing the When to "onAfter" instead of "onBefore" and have tested using "source" instead of "target" and am not getting records created.
I have attached a full screenshot of my current transform script for better review\assessment:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2023 10:28 AM
You need to define your JSON object first then add it to your cart....oh I see you're doing that with the newItem (more confusing to read that way) declaration but I don't see it being called....doesn't look like newItem or checkoutInfo are being triggered.
var item =
{
'sysparm_id': 'sys_id_goes_here',
'sysparm_quantity': '1',
'variables':{//example copied from docs page
'carrier': 'at_and_t_mobility',
'data_plan': '500MB',
'duration': 'eighteen_months',
'color': 'slate',
'storage': 'sixtyfour'
}};
var cartDetails = cart.addToCart(item);//now you can add the item to the cart
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-02-2023 09:29 AM