This message was deleted.
# ask-stanley-ai
s
This message was deleted.
c
AI generated answer (using internal Slack threads):
Based on the conversations, it seems that you can use SuiteScript to override the tax amount or gross amount of the invoice based on a custom field. However, this might require a bit of scripting and the use of a Workflow Action Script. Here is a sample Workflow Action Script that was shared in the conversation:
Copy code
code
/**
 * @copyright 2023 <http://Carsales.com.au|Carsales.com.au>
 * @author Michoel Chaikin <michoel.chaikin@carsales.com.au>
 * @NApiVersion 2.1
 * @NScriptType WorkflowActionScript
 *
 * Workflow Action Script to set the value of any line level field on a workflow. The native Set Line Value workflow
 * action only supports specific sublists and fields.
 */
define(["N/runtime"], (runtime) => {
  var exports = {};

  /**
   * @param {import("N/types").EntryPoints.WorkflowAction.onActionContext } context
   */
  exports.onAction = function (context) {
    log.debug({ title: "=== WA Script Starting ===" });

    const script = runtime.getCurrentScript();

    const sublistId = script.getParameter({ name: "custscript_cs_setsublistvalue_sublist_id" });
    const fieldId = script.getParameter({ name: "custscript_cs_setsublistvalue_field_id" });
    const line = script.getParameter({ name: "custscript_cs_setsublistvalue_line" });
    const value = script.getParameter({ name: "custscript_cs_setsublistvalue_value" });

    log.debug({ title: "script parameters", details: JSON.stringify({ sublistId, fieldId, line, value }) });

    context.newRecord.selectLine({ sublistId, line });
    context.newRecord.setCurrentSublistValue({ sublistId, fieldId, value });
    context.newRecord.commitLine({ sublistId });

    log.debug({ title: "=== WA Script Complete ===" });
  };

  return exports;
});
This script allows you to set the value of any line level field on a workflow. You can use this script to set the value of the tax amount or gross amount based on a custom field. ****** 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.861679554
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.856835604
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.849860132
Please provide your feedback on this answer.