Discussions
Check out Oracle NetSuite upcoming events and conferences here
Now is the time to ask your NetSuite-savvy friends and colleagues to join the NetSuite Support Community! Refer now! Click here to watch and learn more!
Update your Profile with your Support type to get your Support Type badge.
Expand your NetSuite knowledge by joining our Ask A Guru Live sessions. RSVP on this event now.
Get ready to take on exciting new challenges and become the next SuiteMaster of the Month!
Join the largest gathering of the NetSuite Community at SuiteWorld in Las Vegas, September 9-12! Discover cutting-edge innovations, attend insightful sessions, network with industry leaders, and elevate your business to new heights. Register here!
How to Map the Invoice lines to its SO lines via SuiteScript 2.0?
Hello. I'm running a script on the Invoice record. This script's aim is to take the value of the line field "custcol_altsales_invoice" from the invoice and map it to the corresponding SO line in a field called "custcol_ccaw_test_field_1". The issue is that this works if everything is invoiced at once (all the lines from the SO are present on the invoice). It will map incorrectly if, say, I only invoice some lines from the SO. Is there a way to map each line from the invoice to its exact line on the SO?
/** * @NApiVersion 2.x * @NScriptType UserEventScript * @NModuleScope SameAccount */ define(['N/record'], function(record) { function updateCommissionOnSalesOrder(context) { //only run if it's edit or create if (context.type == 'create' || context.type == 'edit') { //reference the current invoice var invoiceRecord = context.newRecord; // Get the Sales Order ID from the Invoice record's "Created From" field var salesOrderId = invoiceRecord.getValue({ fieldId: 'createdfrom' }); // Get the line count on the Invoice record var lineCount = invoiceRecord.getLineCount({ sublistId: 'item' }); // Update the "Commission Calculated" field on the
0