POSTing a new record with a connection

I am posting a new record (a purchase order) via the API and want the new record to include a CONNECTION to an existing record in another table (Trade = vendor).

I have verified that I have the correct ID of the Trade, but can’t manage to insert it into the new record’s connection field. There is no error, but the connection field is blank in the new record.

        // 1) get record ID of connected Trade
        var TradeArray = record["field_83_raw"];                        
        var TradeRecId = TradeArray[0].id;                         // returns 6112de58e52bbe001ea75d74

                    // 2) ADD A RECORD TO PURCHASE ORDERS TABLE
                    // neither of these syntax are successful
                    var MydataObject = {						   
                        //"field_149_raw": [TradeRecId]        
                        "field_149_raw": TradeArray[0].id

I figured it out. I was trying to POST to the raw version of the field. The syntax that works is

 "field_149": TradeArray[0].id  
1 Like