Declare Attribute Tags for Tags Within Tags
You must use the declareAttribute tag when you add an attribute tag in a field and use a site template to show that field on your website. The NetSuite tag replacement engine needs the declareAttribute tag to show embedded tags.
Behind the scenes, the NetSuite tag replacement engine scans each page twice to find the attributes in your custom HTML and ensure that they show up correctly on your web pages. On the first scan, it finds the attributes used in each tag but skips over the embedded tags. On the second pass, it replaces all the tags on the page, including embedded ones. Use the declareAttribute tag to point to embedded tags.
Using declareAttribute Tags
You can use declareAttribute tags in item/category templates or Hosted web pages.
For example, you may create an item drilldown template that contains an attribute tag for the detailed description field on an item record:
<%=getCurrentAttribute('item','storedetaileddescription')%>
The HTML in the detailed description field may contain an attribute tag for the item name:
<%=getCurrentAttribute('item','storedisplayname')%>
To display all the information in the detailed description field from the item record, you must use the declareAttribute tag for the item name in front of the Attribute tag for the detailed description field. For example:
<%=declareCurrentAttribute('item','storedisplayname')%><%=getCurrentAttribute('item',
'storedetaileddescription')%>.
Use the appropriate declareAttribute tag listed below to ensure the embedded tag is rendered properly in your site. Note that the declareAttribute tag takes the same parameters as its corresponding Attribute tag.
Syntax:
-
declareAttribute
<%=declareAttribute('item',7,'storedisplayname')%><%=getAttribute('item','storedetaileddescription')%>.
-
declareCurrentAttribute
<%=declareCurrentAttribute('item','storedisplayname')%><%=getCurrentAttribute('item', 'storedetaileddescription')%>.
-
declareRecordAttribute
<%=declareRecordAttribute('24',34,'custrecord80')%><%=getRecordAttribute('24',34,'custrecord85')%>