Forums/Community/Zendesk Apps

Is there a way to register interest in custom field changes dynamically

Alan Byrne
posted this on September 19, 2012 07:48

Using lotus, I can see how I can register an interest in a change to a custom field declaratively e.g.

events : {

  "ticket.custom_field_1234.changed" : "customField1234Changed"

}

I have the situation where the fields I want to monitor for changes is dynamic and supplied via the manifest settings variables.  Is there a way to dynamically create these event listening hooks.

If this is not possible I guess I a fall back position would be to a register a method which is called when any custom field value changes.  Is this possible?

 

Comments

User photo
James Rosen
Zendesk

The app framework has neither support for adding/removing event listeners nor for declaring a listener on all ticket fields or all custom ticket fields. It is clear, though, that published apps (those available to all accounts) will need some solution for this. We're exploring some options and will update the framework changelog and errata page when we have more information.

September 19, 2012 08:53
User photo
Alan Byrne

I need to be able to have access to this functionality for many of my apps (which presumably won't be published), so please consider making this functioanlity available generally to all apps.

Can you give me an indication of when we are likely to get this kind of functionality.

September 19, 2012 09:44
User photo
James Rosen
Zendesk

Alan: whenever we make it available to published apps we'll make it available to private ones as well. They use the same framework. I cannot give you any sort of precise estimate.

September 19, 2012 09:47
User photo
Grant Robertson

I too am interested in dynamically attaching events to custom fields.

November 27, 2012 17:01
User photo
Alexis Tondelier
lafourchettehubb2b

Listening on custom fields "changed" events with field id being read from the app's settings is needed to avoid hard coded field ids in app.js. 

So, hoping it will be implemented soon.

The dynamic aspect may sound a little complicated facing the defineApp method's behaviour. An easier workaround would be to trigger a "ticket.custom_field.changed" event that would contain the field id as a parameter of the event.

 

Maybe there is already such a mutualized event for custom fields changes ?

April 17, 2013 06:04
User photo
mejaguar

events:

  '*.changed': function(event) {

    // event.propertyName = fieldname of the changed field

  }

}

 

You're welcome.

April 17, 2013 08:42
User photo
Alexis Tondelier
lafourchettehubb2b
Thanks for both answers.
I should have tried the joker * !
However as soon as an event specific to custom field events exists it will be a better practice.
Thanks again.
April 17, 2013 11:34
User photo
Jake Holman
Product Manager

Yep, what mejaguar put will work. We've not documented this just yet, but it's on the way. I've attached an app you can use to see how it works.

April 17, 2013 12:48