Does anyone know if its possible to detect the Net...
# advancedpdf
e
Does anyone know if its possible to detect the NetSuite environment in the Advanced PDFs? Not sure if there is a reserved variable like .locale that can be referenced if at runtime its in Sandbox. The goal is to add a Watermark to any PDFs generated in Sandbox automatically and not have to edit the PDF when moved to Production
n
Not aware of a way, maybe have a UE script add a custom field something like custpage_environment with the environment set in it, you could pick it up in the ADV PDf then.
s
you can try
${record.url}
AFAIK, it was returning the complete url (including the account id) to the record being printed. you can then differentiate if it contains “-sb” or any other validator you prefer
below check might return true for production but I did not test 🙂
${record.url?lower_case?starts_with("<https://123456.app>")}
e
Thanks for the ideas. I originally implemented something similar to what you suggested @Selcuk Dogru. Except instead of the url, I look at the
companyinfomration.companyid
string. and if its matches the sb account then show the watermark. Basically something like this:
Copy code
<#if companyinformation.companyid == "12345_SB1">
     <h1 id="watermarkbody" rotate="-30" valign="middle" align="center" style="color:red; font-size: 72px; position:absolute; z-index: 1000;">
         SANDBOX
     </h1>
</#if>
While not the ideal logic its working. I was hoping for something a bit more universal and not a "hardcoded" option. Thats why I was hoping for a runtime environment variable to determine Production or Sandbox or Release Preview Thanks again for responding though.
I ended up using the "contains" built in to look for _SB
Copy code
<#if companyinformation.companyid?contains("_SB")>