```while (loadedEmployee.getLineCount({sublistId: ...
# suiteflow
z
Copy code
while (loadedEmployee.getLineCount({sublistId: 'recmachcustrecord_bob_wh_employee'}) > 0){
                    log.debug({
                        title : 'lineCount while',
                        details : loadedEmployee.getLineCount({sublistId: 'recmachcustrecord_bob_wh_employee'})
                    });
                    loadedEmployee.removeLine({
                        sublistId :'recmachcustrecord_bob_wh_employee',
                        line : 0
                    });

                }
                
loadedEmployee.save();
What’s wrong with this part of code? I am trying to remove all sublist lines with WORKFLOW action script. No errors, log.debug count 5,4,3,2,1 (after removing lines getLineCount decrease for 1). After .save() I have ALL lines remain! Workflow action is executed in VIEW mode of record, in the ENTRY state after transition on button click….
j
Code looks fine if it was removing items from a transaction — I wonder if it’s something to do with the custom record
custrecord_bob_wh_employee
itself? What happens with them if you try to remove via the UI? Do you get bob_wh_employee records that are just orphaned with no value in the parent field, or do they get deleted?
This might be better suited to #C29HQS63G
z
my mistake (even I expect error) … Allow delete has not been checked on the custrecord_bob_wh_employee definition form (only allow remove and allow child ….) It is dangerous zone (remove creates orphan) I know, but now everything works fine …
it is very first time that I use workflow action, and doubt is there something I don’t know about how workflow works