``` record.attach({ record...
# suitescript
k
Copy code
record.attach({
                        record:{
                            type: record.Type.CONTACT,
                            id: contactId
                        },
                        to:{
                            type: record.Type.VENDOR,
                            id: context.request.parameters.custpage_venid,
                            attributes: {
                                role: '-10'}

                        }
I am trying to attach a contact record to a vendor and assign primary contact role to it. This is what I am trying and it is not working. Any thoughts?
b
not working is too broad
be more specific
k
This script is working to assign the contact to the vendor but I can not get the role to be set to primary
I sorted it out. My syntax was not quite right I needed
to:
to be an object of only
type
and
id
key value pairs
Copy code
record.attach({
                        record:{
                            type: record.Type.CONTACT,
                            id: contactId
                        },
                        to:{
                        type: record.Type.VENDOR,
                        id: context.request.parameters.custpage_venid
                    },
                            attributes: {
                                role: -10}

                    })