this is part of my script on a IF ``` var rec = sc...
# suitescript
s
this is part of my script on a IF
Copy code
var rec = scriptContext.newRecord;
       var salesorder = rec.getValue({ fieldId: 'createdfrom' });
        //var  addressdata =   rec.getValue({ fieldId: 'shipaddress' });
       var addresstext = rec.getValue({ fieldId: 'shippingaddress_text' });
       
         var  county=  rec.getValue({ fieldId: 'shipcountry' });
          var  state=  rec.getValue({ fieldId: 'shipcity' });
          var shipcompany=  rec.getValue({ fieldId: 'shipcompany' });
            var shipcity=  rec.getValue({ fieldId: 'shipcity' });
             var shipaddr1=  rec.getValue({ fieldId: 'shipaddr1' });
              var  shipphone=  rec.getValue({ fieldId: ' shipphone' });
           var shipaddr2=  rec.getValue({ fieldId: 'shipaddr2' });
s
perhaps the address subrecord is being used instead of these body level fields?
s
actully addresstext works
s
Unfortunately, that link is almost 4 years old 🙂
my understanding is NS is trying to get everyone to use address subrecords and I think any straggling body fields are likely to go away in the future. Others may understand it differently.
s
i know this makes it so confusing
this is from the xml verison of the page
Copy code
<shipaddr1></shipaddr1>
<shipaddr2> Apartment 606</shipaddr2>
<shipaddress>Gant<br>6 street<br>Al Jaber Tower 4,  606<br>D <br>United Arab Emirates</shipaddress>
s
indeed, but using fields from the XML version of a page is totally at your own risk if those fields aren't documented.
s
true
s
I'd recommend you try
shippingaddress
as a subrecord
👍 1
s
I might be missing something when you say sub-record you mean line field and not body fields?
s
the body field named
shippingaddress
, which is a subrecord
s
I have that problem is it is a string of the whole address and the carrier needs me to split it up, I don't want to go down the route of programing striping out the data
s
nay, you need to load
shippingaddress
as a subrecord. Maybe battk can point you to the subrecord apis.
Or you could use NFT where you don't think about the different apis - it makes data access uniform.
s
this is the error i get
Copy code
Field shipaddress is not a subrecord field
s
it's
shippingaddress
not 'shipaddress`
s
"this drives me mad" i took the field id from the page
@stalbert but thank you for your help
s
yes, look to the records browser and
shippingaddress
is listed as a summary, but if you click that summary link it takes you to Address (subrecord)
s
and it returns a javascript object ?
s
it returns a
SubRecord
unless you're using NFT in which case yes it returns a JS object (or rather an instance of a class)
s
thanks
on a different topic if an external api returns a zpl data and i need the user to print it what is the best strategie
s
I've heard of that format but never worked with it myself.
you might want to ask on the NS Pros forum instead https://netsuiteprofessionals.com/questions/
s
thanks