Netsuite Invalid API usage Error. You must use getValue to return the value set with setValue

In dynamic mode, you can use getText() without limitation but, in standard mode, limitations exist. In standard mode, you can use this method only in the following cases:

  • You can use getText() on any field where the script has already used setText().
  • If you are loading or copying a record, you can use getText on any field except those where the script has already changed the value by using setValue().

Apparently the newRecord object falls under the second criteria. At this point, the object only has values set. tranid will have a value with the transaction’s internal ID, but it won’t have the transaction name stored. To get the text, you will have to use record.load() to get the full record, or use search.lookupFields() to get just the transaction name.

Leave a comment

Your email address will not be published. Required fields are marked *