using SutieScript 2.1, set the hastotals on the se...
# ask-stanley-ai
d
using SutieScript 2.1, set the hastotals on the search.create
c
AI generated answer (using internal Slack threads):
To set the
hasTotals
on the
search.create
in SuiteScript 2.1, you can use the
search.create
method and set the
hasTotals
property to
true
. However, it's important to note that the
hasTotals
property is not available in all search types. Here is an example of how you can do it:
Copy code
javascript
var mySearch = search.create({
   type: search.Type.SALES_ORDER,
   filters: [
      ["type", "anyof", "SalesOrd"],
      "AND",
      ["internalid", "anyof", netsuiteId],
   ],
   columns: [
      search.createColumn({ name: "tranid", label: "Document Number" }),
      search.createColumn({
         name: "taxtotal",
         label: "Amount (Transaction Tax Total)",
      }),
      search.createColumn({
         name: "total",
         label: "Amount (Transaction Total)",
      }),
      search.createColumn({
         name: "shippingamount",
         label: "Amount (Shipping)",
      }),
      search.createColumn({
         name: "formulatext",
         formula: "NVL({discountamount}, 0)",
         label: "Amount Discount",
      }),
   ],
   hasTotals: true,
});
****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ******
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.813728154
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.811015368
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.803140879
Please provide your feedback on this answer.