...
- Obtain the GE you're interested in. Generally this will be a GE that already exists; you don't actually want to get a new GE object. If you don't know how to access the GE from the current code location, place a breakpoint and explore the data available to you. You may also want to read:
- Define your callback function. This function will receive two arguments, paramData and eventData.
- paramData is an object containing:
- GE: the GE object on which the value changed
- param: any extra information the event caller wanted to pass along
- eventData is an object containing:
- field: the name of the field that changed
- value: the new value of the field
Since you will call this function every time any field value on the GE changes, you'll need some extra logic inside to call the correct function for each field. For most cases, you probably won't want to do anything at all. We generally handle this by switching on the lower-cased value of the field name.
For example, if we wanted to do something each time a Person GE's FirstName field changed, we would define a function like this:Code Block language js function _geFieldValueChanged(paramData, eventData) { try { switch(eventData.field.toLowerCase()) { case "firstname": // call a function to do on-first-name-changed logic break; default: // for most fields, do nothing break; } } catch (ex) { Aptify.framework.exceptionManager.publish(ex); } }
- paramData is an object containing:
Call the GE's registerNotifications() function, providing the GEFieldValueChanged notification and your callback function:
Code Block language js ge.registerNotification({ event: Aptify.framework.configuration.eventDefinitions.GEFieldValueChanged, callBack: _geFieldValueChanged });
...