```var avgCost = item.getValue({ field...
# suitescript
j
Copy code
var avgCost = item.getValue({
            fieldId: 'averagecost',
        });
        log.debug({
            title: itemId,
            details: "Average Cost: " + avgCost
        });
        var purchasePrice = item.getValue({
            fieldId: 'cost',
        });
        log.debug({
            title: itemId,
            details: "Purchase Price: " + purchasePrice
        });
        var lastPurchasePrice = item.getValue({
            fieldId: 'lastpurchaseprice'
        });
How come only purchasePrice returns a value? There's values for all 3, yet avgCost and lastPurchasePrice return blank
s
averagecost
and
lastpurchaseprice
both pull values from me after record.load
j
My script is a beforeSubmit script, would that affect the ability to load the values? The item record already has values in the fields, I don't understand why it cannot pull the value.
s
Yes, it could in theory since they are calculated things behind the scenes and not defined on the record
j
That is unfortunate, I guess clunky afterSubmit script it is.
s
I avoid average cost field in general since it's not in the same units as purchase price/last purchase price
j
What do you mean?
s
Average cost is in stock units, Purchase Price/Last Purchase Price are in purchase units... so if your item uses unit of measures, you gotta convert the numbers
j
Ahh, I do not believe we are using unit of measures, so that does not affect us currently
Good thing to keep in mind for the future though, thanks!