Script working inside a trigger but breaking inside an object function, why
Content
I'm working on a custom object. When I run a script from a trigger it works but if I run the same code from an object function, it throws an error saying "Cannot invoke method getAttribute() on null object". The script populates a long text field with a lead's property:
def vo = newView('Lead')
def foundRows = vo.findByKey(key(100000222932042),1)
def foundRow = foundRows[0]
setAttribute('LongTextField_c', foundRow.getAttribute('PrimaryContactPersonLastName'))
Any clue about this strange behavior? How can it be surpassed?
Tagged:
0