This topic contains 13 replies, has 0 voices, and was last updated by michoel 8 years, 5 months ago.

  • Author
    Posts
  • #2084

    elie

    Where is the documentation for which fields are available or not in the Advanced PDF/HTML Templates? While working on the Sales Order, we would like to add the quantity back ordered field, and others. Any ideas?
    This is a cached copy. Click here to see the original post.

  • #2085

    cdelacruz

    Please check the SuiteScript Records Browser in SuiteAnswers Article: Working with the SuiteScript Records Browser (Answer ID: 10511)

  • #2086

    elie

    I am familiar, thanks. I just realized that there is a Sales Order record, independent of the Transaction record in the Records Browser! It’s documented there, but not under the generic Transaction.

    Thanks!

  • #2087

    michoel

    In addition to the Script Browser, there are some other ways for figuring out field names for use in scripts and PDF templates:Enable the ‘Show Internal IDs’ preference, and the Field IDs for body level fields will appear in the field help popup window.
    Add the string ‘&xml=T’ to the end of the URL for the record to see the record in XML
    Load the record in your browser console using nlapiLoadRecord() and examine the object returned

  • #2088

    rporteous

    Hi elie

    Originally posted by elie

    View Post

    Where is the documentation for which fields are available or not in the Advanced PDF/HTML Templates? While working on the Sales Order, we would like to add the quantity back ordered field, and others. Any ideas?

    I discovered across in the LinkedIn NetSuite users group that had the best answer that works mostly for me..

    Simply append this “&xml=t” to the end of any transaction in your browser, see this example from an estimate;

    Before

    After

    Once this is done, you will see heaps of XML field names which can be referenced!

    So for example you can find the XML field One Infinite Loop
    Cupertino CA 95014 and use it like this in the your Advanced PDF/HTML Template.${record.billaddress}

    Which will render like this in a PDF document, where the
    gives us a line break;One Infinite Loop

    Cupertino CA 95014

    I was searching for something like this for ages!

    Russ

  • #2089

    elie

    Yes! If you look at the response from michoel earlier you will see other (even better at times) options as well, but this is great, definitely!!

  • #2090

    k_dunc

    Quick question regarding michoel’s last point:

    Load the record in your browser console using nlapiLoadRecord() and examine the object returned

    What does this actually mean? How would one do this?

  • #2091

    michoel

    Hi k_dunc,

    In Chrome, you can use the shortcut Ctrl + Shift + J to access the Developer Console, which allows you to interactively enter JavaScript expressions and examine the results. If you open it on a page that has loaded the NetSuite Client Side API, you can directly call Client Side API functions and see the output which I find to be a huge time saver in writing Netsuite scripts.

    See the image below for an example of using nlapiLoadRecord() to explore the nlobjRecord and find all the available fields. (Keep in mind that some of these may be undocumented and therefore might break without notice in future updates).

  • #2092

    k_dunc

    Wow! Thanks for that michoel. That’s great. Thanks for sharing.

  • #2093

    elie

    This is all great, but I have more information that I know is available via SuiteScript but am not sure how to approach retrieving that info via the templates.

    For example, execution contexts. I want to retrieve the “system.netsuite.com” vs “system2” or “sandbox” – any ideas?

  • #2094

    elie

    Anybody? I need some help, here. I would like to pull the environment from the execution context, at the very least. So, similar to context.getEnvironment in SuiteScript, or better even, because I’d rather the actual uri than the string “PRODUCTION” or “SANDBOX” – but I’m not sure how to even get that in the Freemarker Templates?

  • #2095

    michoel

    elie I would also find this very useful. I’ve submitted a case to support and will let you know.

  • #2096

    dlindores

    You could try accessing companyInformation.logoUrl – this will contain the URI. You’ll need to find a way to perform logic on this, I’ve been trying to use the “contains” Freemarker built-in to check whether the link contains the word “sandbox” but this has been unsuccessful so far. Other options such as substrings might be the answer, but that should at least get you a step closer.

  • #2097

    michoel

    dlindores – great that works perfectly! Not sure what error you are getting?

    Code:
    Sandbox Production
    elie, support raised Enhancement #398152 for this, thought the above work around seems to work.

You must be logged in to reply to this topic.