Hello All, Can we attach Bank Details of Custom Re...
# general
k
Hello All, Can we attach Bank Details of Custom Record Type to Vendor record entity through Restlet...
b
depends on the setup of the custom record. It looks like a Custom Child Record Sublist
that means you should be able to treat it as a sublist on the vendor record, or if you are creating or editing a custom record, you can use record.attach or you can set the field on the child record used for the parent/child relationship
k
tried something like this record.attach({ record : { type : 'customrecord_2663_entity_bank_details', id : recordId }, to : { type : record.Type.VENDOR, id : vendorId } //attributes : { //role : '' //} // -10 :Primary contact });
b
you should have gotten an error saying you need to specify the field used for the parent/child relationship in the attributes
k
Got this error nlapiAttachRecord: Missing a required argument: attributes.field
b
do what the error tells you to do
set the field key of the attributes parameter object to the internal id of the field used to create the parent/child relationship
k
tried with the changes record.attach({ record : { type :'customrecord_2663_entity_bank_details', id : '45' }, to : { type : record.Type.VENDOR, id : vendorId }, attributes : { field: 'name', field: 'custrecord_2663_entity_bank_type'
getting an error You have entered an invalid type argument: customrecord_2663_entity_bank_details
b
are you sure you have the correct custom record type and field
k
here is the custom record referring the same
b
and the custom field?
You are attaching a custom child record to a parent vendor record
k
yeah
b
attributes.field refers to the internal id of the field which is used for the parent/child relationship
that would be a list/record custom record field on the child custom record whose source is vendor and has the
Record is Parent
checkbox checked
i highly recommend going through the documentation on Custom Child Record Sublist before attempting anything
The non-suitescript focused Parent-Child Record Relationships is good too