Reputation: 342
I'm attempting to use SuiteScript to get an array of the values in the "Promotions" sublist (SuitePromotions is turned on). The nlapiGetLineItemField is returning a strange output "com.netledger.app.common.scripting.version1.nlobjFieldImplV1@1e874f2e" rather than the internal ID or name of the promotion. How do I access the sublist data in this object? Here's my code:
//get the promotions used on the transaction
var transPromos = [];
var promoCount = nlapiGetLineItemCount('promotions');
for (var promoNum = 1; promoNum <= promoCount; promoNum++){
var promoName = nlapiGetLineItemField('promotions', 'promocode', promoNum);
transPromos.push(promoName);
}
nlapiLogExecution('DEBUG', 'transPromos', transPromos);
And then later...
for (var k = 0; k < transPromos.length; k++){
nlapiLogExecution('DEBUG', 'transpromo' + k.toString(), transPromos[k]);
}
Log shows:
transPromos: com.netledger.app.common.scripting.version1.nlobjFieldImplV1@592bd210 transpromo0: com.netledger.app.common.scripting.version1.nlobjFieldImplV1@592bd210
I want it to print the internal ID or the name of the promotion. What am I missing here? Why does it show this strange code instead of the internal ID?
Upvotes: 0
Views: 758
Reputation: 342
I figured out a way to do it. I used nlapiGetLineItemText() instead of nlapiGetLineItemField() to get the name of the promotion.
Upvotes: 2