I've created a custom record type called PALLET as parent and a custom record type COMPONENT as child lines because it is one to many relationship. In another words, one PALLET can have multiple COMPONENTS. I can access PALLET from suitescript as below
function beforeSubmit(context) {
var record = context.newRecord;
record.setValue('custrecord166', '8888');
}
However, I cannot access COMPONENT from PALLET using suitescrpt and it return -1
function beforeSubmit(context) {
var record = context.newRecord;
var lineCount = record1.getLineCount({sublistId:"recmachcustomrecord_pallet_component"});
}
Any suggestion is welcome
the sublist id when referenced from a parent account is recmach
+ the field id of the custom field on the child record with is tagged to the parent.
ie.
parent record = customrecordparent123
(Named "My Parent Record")
child record = customrecordchild123
on your child record, you will have a custom field of type list/record of type "My Parent Record".
This field will have "record is parent" ticked. Say this field's id is custrecordmylinkedparent
.
when you reference the child record as part of a sublist, it will be sublistId:'recmachcustrecordmylinkedparent'
, referencing the child record field.
!! Remember, the recmach is not the parent record, but the linking field on the child record.