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 usedsetText(). - If you are loading or copying a record, you can use
getTexton any field except those where the script has already changed the value by usingsetValue().
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.