I'm trying to get the PO value that is found on th...
# suitescript
c
I'm trying to get the PO value that is found on the related records in the vendor bill. I tried doing this var purchaseOrderId = currentRecord.getSublistValue({ sublistId: 'purchaseorders', fieldId: 'poid', line: 0}); ​ but its coming up blank. Any thoughts?
b
if you are trying this clientside, you want to use N/record to load the record instead
c
Ya I’m doing a client side triggering in field change. Do I need to load the record? Is that why I can’t get the po? Or what’s the reason for record vs currentrecord?
b
it just happens that the currentRecord doesnt have the data you need while the regular one does
sublists that you cant edit dont officially support suitescript
the related records one tends to have better support, im guessing because enough people have asked for it
c
I’ll give it a shot with record. Thanks!
@battk going on with this script the next step I'm running a client script to automatically add the customer on the Customer field in the Expense line. var customer = '1'; currentRecord.setCurrentSublistValue({ sublistId: 'expense', fieldId: 'customer', value: customer }); its registering the customer but it doesn't set the field on the line.
b
is the proper expense line selected?
and potentially committed
c
I did with the memo field on the line with the same format and it worked fine, was hoping customer would do the same
b
my questions remain