Discussions
pageInit and default sublist values
I am trying to update the PORate field with another field on the item sublist when a quote is copied to a Sales Order. However the values are not updating. I am using a pageInit to update the fields after they're loading during the copy process. Any ideas on how to make this work?
pageInit(type)
{
//Check if order is being created from an estimate
var stCreatedFrom = nlapiGetFieldValue('createdfrom');
if (stCreatedFrom != null && type == 'copy')
{
var lineNum = nlapiGetLineItemCount('item');
// Run through each line item looking for items.
for ( i = 1; i <= lineNum; i++)
{
var stUnitCost = nlapiGetLineItemValue('item','costestimaterate',i);
nlapiSetLineItemValue('item', 'porate', i, stUnitCost);