javascriptdomnetsuitesuitescript2.0

How to find the related records in a Sales Order on NetSuite?


We have a Sales Order and it has related Purchase Order and Invoice. All the records have the same PO UNIT COST field on them and the PO UNIT COST value should be the same.

I tried to develop a function to update the PO UNIT COST on Invoice once the value on PO is updated.

I know the related records can be found in the "Related Records" sublist on SO. Thus I must find out which SO is related to the PO, and then which Invoices are related to the SO as the following picture:

enter image description here

I know the id for the records are named tranid, and my idea is use code as follows to get the tranid:

var trainID= so_record.getSublistValue({
       sublistId: related_record_tab,
       fieldId: 'tranid',
       line: 1
});

But I don't know what the id (related_record_tab) of "Related Record" tab is.

Is there any id for "Related Records" tab just as the 'item' is the id of "Items" tab? How to find it?


Solution

  • Try 'links' as the tab ID.

    If you're not familiar with it, appending '&xml=T' to the end of a URL in NetSuite can be helpful for finding out IDs for some of the more obscure references to objects in NS.