how can I attach an existing `CONTACT` record to a...
# suitescript
r
how can I attach an existing
CONTACT
record to a
CUSTOMER
record? I thought it was a normal sublist operation but getting an error
SSS_INVALID_SUBLIST_OPERATION
s
you can do it via record.attach method
r
ah, thank you. didn't realize it was via the
record.attach()
method
b
in general you use record.attach when you use the attach button
r
yea, that's on me. I saw it on the customer record, and I even saw the method when looking through
N/Record
API, but my brain just wasn't connecting the two. Appreciate the heads up.
can you attach a saved record to a record that hasn't been saved yet? Ie can I do
Copy code
record.create()
...
record.attach()
...
record.save()
or do I have to do
Copy code
conRecord = record.create()
...
conIID = conRecord.save()
cusRecord = record.create()
...
cusRecord.save()
cusRecord.attach(...conIID...)
b
you should be able to figure that one out after you learn how to use record.attach
👍 1