Forum Discussion

conner_davis's avatar
conner_davis
Ideator I
2 years ago
Solved

Server Method working when given a GUID, but not when using this

Hello, When I run this server method from the method itself and use a GUID to get the Item I want to update the method works fine, but when I change it from a GUID to = this; and run it from the...
  • conner_davis's avatar
    conner_davis
    2 years ago

    Thank you alaxala,

    Do you have any recommendations on where I could run this as an event then to avoid the recursive call?

    or would going a route of getting a property to key off of like string ksaNumber = this.getProperty("_ksa_number","") not be a recursive action? or because that call is still using this it will be recursive?

  • alaxala's avatar
    alaxala
    2 years ago

    In context of OnBeforeUpdate method you can change "this" any way, but you can't use this.apply() or perform any actions that will result in an this item being written to the database because it will trigger OnBeforeUpdate again.

    When you inside OnBeforeUpdate you inside some upper "apply" already. So just change properties of "this" and return this. All your changes will be applied calling code.