Using Helpers for Debugging in SuiteCommerce

Use log helpers in SuiteCommerce to debug templates and inspect object content easily.

·2 min read·View Oracle Docs

TL;DR Opening

Helpers are invaluable for debugging in SuiteCommerce, allowing developers to log object contents directly to the console or page. This helps illuminate the context and model properties within templates.

How Do Helpers Aid Debugging?

In SuiteCommerce and SuiteCommerce Advanced (SCA), built-in helpers provide developers with the ability to print out information for easier debugging. The most commonly used helper for logging is the log helper, which you can utilize for inspecting the current context and model data.

Using the log Helper

To effectively employ the log helper:

  • To log the view's context object, you would use:

    template
    {{log this}}

    Note: The this keyword is contextual and may change based on usage, such as in an iterator or block.

  • To log the model data, you can use:

    template
    {{log model}}

Understanding Logged Properties

In recent iterations of SuiteCommerce templates, developers have access to a list of properties they can use and review. At the bottom of each template, the properties sent to it can be found, which helps in ensuring that the correct values are being utilized.

Who This Affects

  • Developers: Primarily those creating or maintaining SuiteCommerce or SCA projects. Understanding how to use helpers is essential for efficient debugging.

Key Takeaways

  • Utilize the log helper for efficient debugging of context and model objects in SuiteCommerce.
  • Be aware of the contextual nature of the this keyword in templates.
  • Check the bottom of templates for a list of properties sent for easier troubleshooting.

Frequently Asked Questions (4)

Does the `log` helper work with both SuiteCommerce and SuiteCommerce Advanced?
Yes, the `log` helper is available for use in both SuiteCommerce and SuiteCommerce Advanced projects, allowing developers to log object contents for debugging purposes.
How do I log the current view's context object in a template?
To log the current view's context object, you would use the code `{{log this}}` in your template. The `this` keyword refers to the current context, which changes depending on where it is used.
What should I be aware of when using the `log` helper in templates?
When using the `log` helper, remember that the `this` keyword is contextual, meaning its value can change based on its usage location, such as within an iterator or block.
How can I verify the properties sent to a SuiteCommerce template?
To verify properties sent to a template, check the bottom of the template where a list of these properties is typically provided. This helps in ensuring the correct values are used during troubleshooting.
Source: Use Helpers for Debugging Oracle NetSuite Help Center. This article was generated from official Oracle documentation and enriched with additional context and best practices.

Was this article helpful?

More in General

View all General articles →