Forum Discussion

Frank_Guarino's avatar
Frank_Guarino
Creator III
3 months ago

How to populate 'this' properties?

Hello,

Server event's context of 'this' is barren, in example it has only the Item header and no properties nested inside, therefore only getID() and getType() are the only functions that work.

 

How do I elegantly populate 'this' object? The remarks of fetchDefaultPropertyValues() reads as what would update only properties that have a default value, so I have rejected trying that.

 

I would feel strange doing

this.setAttribute('action', 'get')

this = this.apply(); 

Does that work?

 

Best Regards,

Frank

1 Reply

  • eli_donahue's avatar
    eli_donahue
    Community Manager

    Hi Frank! Could you specify which server event you are using (ex: onBeforeAdd, onAfterUpdate, etc.)?

    Could you also provide a bit more info on how you're checking the item context? For example, are you using the built-in "Run Server Method" action in the method editor, testing the method via Nash, or another approach?