- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
6 hours ago
I have the following Action I'm trying to create to do the following:
1. Take in a string of numbers (this will be sys_id's from the question_choice table that is connected to a catalog item - List item).
2. convert the comma separated sys_ids to an array
3. Output the array so I can loop. over that with a decision table.
I have the following so far:
For Inputs:
for the script action:
Script:
(function execute(inputs, outputs) {
// Read the comma-separated list input
var csv = inputs.ampModule || '';
// .split(',') will give an array of strings
var arr = csv.split(',');
// Set the output array variable
outputs.modulearray = arr;
})(inputs, outputs);
Outputs
I'm not sure what's going on but when I create this an run a test with just numbers like 1111,2222,3333 I get an array back but it's empty. Not sure why, could someone help with this please.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
5 hours ago
HI @Stephencroc ,
you should be using "inputs.sapModule" instead of inputs.ampModule in the 4th line of the script
try this script
(function execute(inputs, outputs) {
// Read the comma-separated list input
var csv = inputs.sapModule || '';
// .split(',') will give an array of strings
var arr = csv.split(',');
// Set the output array variable
outputs.modulearray = arr;
})(inputs, outputs);
Please mark my answer as helpful/correct if it resolves your query.
Regards,
Chaitanya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
5 hours ago - last edited 5 hours ago
hi @Stephencroc
Your input not matching with input you provided in script, please cross check once. Shouldn't it be sapModule?
var csv = inputs.sapModule || '';
Try aligning both the input name properly
Please mark this helpful/solution accepted, if you find this useful
Regards,
Mohammed Zakir
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
5 hours ago
Had no difference, I put in '1111','2222','3333' and still got a blank array returned
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
5 hours ago
Hi @Stephencroc ,
Your scripts run fine after i made input variable change.
Please mark this helpful/solution accepted, if you find this useful
Regards,
Mohammed Zakir
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
5 hours ago
HI @Stephencroc ,
you should be using "inputs.sapModule" instead of inputs.ampModule in the 4th line of the script
try this script
(function execute(inputs, outputs) {
// Read the comma-separated list input
var csv = inputs.sapModule || '';
// .split(',') will give an array of strings
var arr = csv.split(',');
// Set the output array variable
outputs.modulearray = arr;
})(inputs, outputs);
Please mark my answer as helpful/correct if it resolves your query.
Regards,
Chaitanya
