seanlin
07/15/2020, 1:00 AM/**
* Hi All, I have encountered a custom record as a sublist issue:
* I have create a custom record with a customer field (internal id is custrecord_gw_csrc_cust),
* I checked "record is parent" in the customer field setting and I have successfully
* showing the custom record in CUSTOMER record.
* However, when I run the following code in debugger, I failed to get line count of the sublist from customer record.
*
* I tried with contact sublist and it's success
* Then I create a saved search that search for the custom record,
* and then create a custom sublist that uses the saved search I just created.
* The sublist is showing in customer record as well but I still can't get line count.
*
* Did I miss anything in settings, did I do anything incorrectly or (I am suspecting) is this a bug?
*/
require(['N/record'], function(record){
var customer = record.load({
type: record.Type.CUSTOMER,
id: 7083,
isDynamic: true
})
// It's a custom record as a sublist in customer (custom record name is "Customer Sales Return Configurations")
var customRecordAsSublistCount = customer.getLineCount({sublistId:'recmachcustrecord_gw_csrc_cust'}) // Count is 0 (should be 2)
// Tried with contact sublist, it's working
var contactCount = customer.getLineCount({sublistId:'contactrole'}) // Count is 1 (correct!!)
// It's a custom sublist source from a saved search of "Customer Sales Return Configuration"
var customSublistCount = customer.getLineCount({sublistId:'customsublist69'}) // Count is 0 (should be 2)
//var sublist = customer.getSublist({sublistId:'recmachcustrecord_gw_csrc_cust'}) // This will throw an unexpected exception
var sublists = customer.getSublists();
log.debug({title:'test', details:'end'})
})
This is my customer record screen shot that shows the count should be 2battk
07/15/2020, 1:06 AMAllow Child Record Editing
battk
07/15/2020, 1:07 AMseanlin
07/15/2020, 5:51 AM