0
votes

my current issue is, I can't get the value of the field from a sublist in vendor form located at "address tab". here's below used code. Can somebody help me to have a tip for this? Thanks a lot. Uploaded image below that I want to get the value. enter image description here

var label = vendor_record.getCurrentSublistValue({sublistId:'addressbook',fieldId:'country'};
1

1 Answers

0
votes

First of all you're missing a closing ) in your row above, before the closing ;

Anyways, try this instead:

            var vendor_record = record.load({
                type: record.Type.VENDOR,
                id: 177270,
                isDynamic: true
            });

            var addressSubrecord = vendor_record.getCurrentSublistSubrecord({
                sublistId: 'addressbook',
                fieldId: 'addressbookaddress'
            });

            var cityValue = addressSubrecord.getValue({
                fieldId: 'country'
            });

            var cityText = addressSubrecord.getText({
                fieldId: 'country'
            });

Not sure if you want the value or text of the Country field but simply choose between getValue() or getText(), but I printed both in the code above just so you can see. In the case above, cityValue would output "SE" and cityText would output "Sweden".