render.statement with subsidiaryId options passed ...
# ask-stanley-ai
n
render.statement with subsidiaryId options passed is not generating statement for the right subsidiary instead it always generates statement for the primary subsidiary only
c
AI generated answer (using internal Slack threads):
Based on the conversations, it appears that the
render.statement
function in SuiteScript 2.0 does not support the selection of a specific subsidiary. The function seems to always generate the statement for the primary subsidiary, regardless of the
subsidiaryId
option passed. Here is a sample code snippet that was shared:
Copy code
javascript
function renderStatement(options) {
  var printProperties = new Object();
  checkParameters(options);
  if (options.formId) {
    printProperties["formnumber"] = options.formId;
  }
  if (options.inCustLocale) {
    printProperties["incustlocale"] = options.inCustLocale;
  }
  if (options.openTransactionsOnly) {
    printProperties["openonly"] = options.openTransactionsOnly;
  }
  if (options.consolidateStatements) {
    printProperties["consolstatement"] = options.consolidateStatements;
  }
  if (options.statementDate) {
    printProperties["statementdate"] = options.statementDate;
  }
  if (options.subsidiaryId && util.isNumber(options.subsidiaryId)) {
    printProperties["subsidiary"] = options.subsidiaryId;
  }
  if (options.startDate) {
    printProperties["start_date"] = options.startDate;
    printProperties["startdate"] = options.startDate;
  }
  var pdfFile = invoker(renderApi, "nlapiPrintRecord", [
    "STATEMENT",
    options.entityId,
    options.printMode || null,
    printProperties,
  ]);
  return Object.freeze(file.wrap(pdfFile));
}
However, even though the
subsidiaryId
option is included in the function, it does not seem to affect the output of the statement. The statement is always generated for the primary subsidiary. Unfortunately, there doesn't seem to be a workaround for this issue based on the conversations. The users have tried using Advanced PDF/HTML templates and generating the statement via a workflow, but these methods also did not yield the desired results. ****** 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.877797544
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.826248586
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.825392127
Please provide your feedback on this answer.