I have a component in my first flow screen that shows a list of objects I created using a wrapper class in Apex. The four fields on this object are modelNo, Description, StockOnHand, and Quantity.
I have to enter a value into Quantity and pass the Description and Quantity value from this screen, to a new component in the next screen.
Here's where I am running into problems:
- lightning:AvailableForFlowScreens doesn't allow me to have an aura:attribute with a type of either "List" or "Object[]"
- The Description field has a comma in the value, which is making it difficult for me pass the string in a CSV format.
What I am trying to achieve is:
- If my "object" were to be:
{
"Description":"Cooler, 2 Door" ,
"Quantity": 2
}
I want to then create 2 rows in a datatable that each have the same description. If the quantity value was 4, then I'd want to create 4 rows with the same description. This is so that I could set a value (Branding) for each cooler independently in the datatable in the next screen. (I then go on to create the individual records.)
Here's my code from my controller for the first screen. (pardon the mess in my .push line, but this is where i am falling apart). It seems I am formatting the string incorrectly, because although I can display it as a string, I am struggling to access the values and do anything with them:
handleClick : function(component, event, helper){
var response = component.get("v.equipmentList");
var newList = [];
response.forEach(myFunction);
function myFunction(item){
if (item.Quantity > 0){
newList.push('Description' + ':' + '"' + item.Description + '"' + ',' + 'Quantity' + ':' +item.Quantity );
console.log(newList)
component.set("v.selectedEquipmentList", newList);
}
}
},