I have a SuiteLet. it has a sublist. Based on the ...
# suitescript
n
I have a SuiteLet. it has a sublist. Based on the value of one column on the previous line, when the user moves to a new line I want to carry the previous line value. I've coded in the lineInit function to achieve this. I can establish the previous line's column value. NS allows me to setCurrentSublistValue without error, but the value is never there, Any ideas?
Copy code
var lineCount = rec.getLineCount({sublistId:"custpage_item_sublist"})||-1;
				if(lineCount>0){
					var prevItem = rec.getSublistValue({sublistId:"custpage_item_sublist",fieldId:'item',line:(lineCount-1)})||'';
					console.table({"lineCount":lineCount, "item":prevItem});
					if(prevItem !==''){
						rec.setCurrentSublistValue({sublistId:'custpage_item_sublist',fieldId:'item',value:prevItem,ignoreFieldChange:true});
						console.log("set");
					}
				}
(I see the table data and also the "set" in the console.) I've tried to manually set the column with a completely different value hardcoded, thinking maybe the current selected line is perhaps still the previous for some weird reason but still no change. (I've tried with ignoreFieldChange true and false in case fieldchange was tripping things up) I've also tried this in sublistChange when the line is committed, same result.