Netsuite transaction column field recalculate -


I have created a new transaction column field called margin and I added it in the sales order. I have written a script to calculate margin based on item fields, however if you go back to editing the values, the script does not recalculate when a user edits the values, how do I recover it Can i do

  Function post sourcing (type, name) {if (name == 'item') {var unitPrice = nlapiGetCurrentLineItemValue ('item', 'evaluate'); NlapiLogExecution ('DEBUG', 'value', + unitPrice); Var item id = nlapiGetCurrentLineItemValue ('item', 'item'); Var avgCost = nlapiGetCurrentLineItemValue ('item', 'lastpiecepice'); NlapiLogExecution ('DEBUG', 'Cost', + avgCost); Var marginkkalek = monastery (((UnitPrice - Agcost) / UnitPrice) * 100) * 10) / 10; NlapiLogExecution ('DEBUG', 'Margin', + MarginCalak); NlapiSetCurrentLineItemValue ('item', 'custcol9', margin); AvgCost = Math Plane (avgCost * 100) / 100; NlapiSetCurrentLineItemValue ('Items', 'Last PerchSpace', AVGOST); Var Dollarro = Unit Price - Execust; NlapiSetCurrentLineItemValue ('item', 'custcoldollarprofit', dollar pro); Var itemQty = nlapiGetCurrentLineItemValue ('item', 'quantity'); Var extdollar = dollarPro * itemQty; nlapiSetCurrentLineItemValue ('item', 'custcolextdollarprofit', extDollar); NlapiCommitLineItem ('item'); }}    

Then, at the post sourcing event, you have two criteria: type

In a code that you pasted above:

  Function post sourcing (type, name) {if (name == 'item') {  

You are only triggering this code to run when the item 's field in the SoBlist change field has two options: Add unit price and unit cost field to your' if 'statement

  if (name == 'item' || no   

or run it on the entire item list

  if (type == '=' 'last' part ' Item ')    

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -