how do you access `Customer` record from a transa...
# suitescript
j
how do you access
Customer
record from a transaction script?
Copy code
var customer = record.load({
        		type: record.Type.CUSTOMER,
                        id: customerId,
        		isDynamic: true
        	});
is this correct?
s
Depends where you are to being with. Do you just want info from the customer record or do you want to actually do something to it?
transaction script
is kind of vague
j
I'm trying to set some field values on the Invoice record, but it depends on some data on the customer record.
s
If you just want data from the customer record, then just use
search.lookupFields()
, there is usually no need to load the record unless you intend to do something to it.
e
1. Use the Records Browser as a reference for the fields on the Invoice: https://system.netsuite.com/help/helpcenter/en_US/srbrowser/Browser2020_1/script/record/invoice.html 2. Locate the field you want (Customer =>
entity
) and retrieve its value (which will be the internal ID of the entity 3. Use the id to perform a
lookup
to retrieve the appropriate values, using the Search Columns for a Customer as a reference: https://system.netsuite.com/help/helpcenter/en_US/srbrowser/Browser2020_1/script/record/customer.html Video walkthrough:

https://www.youtube.com/watch?v=_fs2thUdEmQ

Article walkthrough: https://stoic.software/effective-suitescript/7-field-lookups-in-ss2/ 1.
j
very helpful! Thanks