Set address field in the tax registration subtab under Financials in the vendor record

 let objRecord = record.load({

                            type: record.Type.VENDOR,

                            id: VendorRecordId //Internal id of the vendor record

                           

                        });

                      objRecord.getSublist({

                            sublistId: ‘addressbook’

                        });

                    let count = objRecord.getLineCount({

                            sublistId: ‘addressbook’

                        });

                      let taxRegArray = []

                        if (sameAddrCheckBox == true) {

                          for (i = 1; i < count; i++) {

                              let addressIdNew = objRecord.getSublistValue({

                                    sublistId: ‘addressbook’,

                                    fieldId: ‘addressid’,

                                    line: i

                                });

                              taxRegArray.push(addressIdNew);

                            }

                        }

                       

                      let taxArraylen = taxRegArray.length;

                      let lineCount = objRecord.getLineCount({ sublistId: ‘taxregistration’ });

                      for (i = 0; i < taxArraylen; i++) {

                            objRecord.setSublistValue({

                                sublistId: ‘taxregistration’,

                                fieldId: ‘address’,

                                line: i, // Modify the first line

                                value: taxRegArray[i] // Internal ID of the address you want to set

                            });

                        }

                        let objRecordId = objRecord.save();

                     

Leave a comment

Your email address will not be published. Required fields are marked *