validation - Intersystems Cache ObjectScript change property value during %Save() -


given:

  • a class named b.
  • 2 persistent records of class b, id = {"b1", "b2"}.
  • a class named a:

    class extends %persistent {  property rb b;  foreignkey fkb(rb) references b(); } 
  • an instance of class a, named obja, obja.rb = "b3" (which invalid value because b has no "b3" persistent record)

i want that:

when obja going saved (obja.%save()), substitute empty string rb invalid value , save it.

so far:

i have tried make substitution using callback methods ( %onbeforesave), seems %validateobject being called before.

is there way of doing value changes before %validateobject using callback methods?

thanks in advance.

you can modify objects in callback method %onaddtosaveset: http://docs.intersystems.com/cache201511/csp/docbook/docbook.ui.page.cls?key=gobj_callbacks#gobj_cb_onaddtosaveset


Comments

Popular posts from this blog

searchKeyword not working in AngularJS filter -

sequelize.js - Sequelize: sort by enum cases -

user interface - how to replace an ongoing process of image capture from another process call over the same ImageLabel in python's GUI TKinter -