How can we add custom lines in the "Summary" secti...
# ask-stanley-ai
j
How can we add custom lines in the "Summary" section of Sales Orders & Quotes? We want an additional line that is separate from the subtotal but adds up into the total.
c
AI generated answer (using internal Slack threads):
To add custom lines in the "Summary" section of Sales Orders & Quotes, you can use a combination of custom fields and SuiteScript. Here's a general approach: 1. Create a custom field (type: Currency) on the Sales Order record. This field will hold the value of your additional line. Make sure to place it in the appropriate subtab where you want it to appear. 2. Write a User Event script that calculates the value for this custom field. The script should be triggered on the 'create', 'edit', and 'recalc' events of the Sales Order record. The calculation logic will depend on your specific requirements. 3. In the script, use the
record.setValue
method to set the value of the custom field. This will update the field every time the Sales Order record is created, edited, or recalculated. 4. To include this custom field in the total calculation, you will need to adjust the 'Net Amount' field. This is a system field and cannot be directly modified, so you will need to adjust the line item amounts to reflect the additional charge. This can be done in the same User Event script. Here's a simplified example of what the script might look like:
Copy code
javascript
function beforeSubmit(context) {
    var record = context.newRecord;
    var subtotal = record.getValue('subtotal');
    var additionalCharge = calculateAdditionalCharge(subtotal); // implement this function based on your requirements
    record.setValue('custbody_additional_charge', additionalCharge);
    adjustLineAmounts(record, additionalCharge); // implement this function to adjust line item amounts
}
Please note that this is a simplified example and may not cover all edge cases. You should thoroughly test this solution in a sandbox environment before deploying it to production. ****** 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.838556349
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.834309161
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.833788037
Please provide your feedback on this answer.