Hello everyone, I'm trying to retrieve the text fr...
# advancedpdf
s
Hello everyone, I'm trying to retrieve the text from billing address' state (note: this is a dropdown in address book) for vendor records in a FreeMarker template. The {entity.statedisplayname} currently fetches the state text from the vendor's shipping address. Does anyone have suggestions on how to obtain the text for the billing address state of the vendor? Additionally, please take note that {entity.address1}, {entity.address2}, and {entity.state} are all pulling details from the shipping address. I'm curious why NetSuite automatically takes this information from the shipping address rather than the billing address.
j
did you try {entity.billingaddress} ?
...or {billaddress} ?
s
Thankyou @Jim Schweder. but I need the state's text which is a dropdown . {entity.billstate} returns the value of that dropdown.
j
Instead of WI you want Wisconsin?
s
yes Jim, thats correct.
I tried using {entity.statedisplayname}. but this is getting me shipping address state name. but i need the billing address state name. I tried {entity.billstatedisplayname}, i got the error its invalid column name.
d
think you're going to have to use a lookup. either an in-template lookup, or a custom body field =/
j
@David B Is correct. I remember finding from another added module a State Name custom table and I used that. If you don't have one in your instance you will need to create one. Here is an example within FreeMarker:
Copy code
<#function state_name state_id>

   <#assign my_state_name = "" />
   <#if state_name = "WI">
         <#assign my_state_name  = "Wisconsin" />
   <#elseif state_name = "AZ"> 
         <#assign my_state_name  = "Arizona" />
   </#if>
 
   <#return my_state_name />
</#function>
Then call it via
${state_name("${entity.state}")}
s
Thankyou @David B and @Jim Schweder for your efforts in providing answers. I'll adopt this approach.