Application Contexts
Last updated
Last updated
At runtime, each application receives or has access to various information about the authenticated user, its location within the Deskpro UI and the Deskpro Object it is associated with it. We refer to this information as the application's Context.
You choose a context for your application when you define a Target in your application manifest. Your are not limited to a single context, as you can have as many Target objects as required. It is also worth knowing that each Target is associated with one Deskpro Object like Ticket, Organization or Person.
The context gives you access to the authenticated user, the type and unique identifier of the target's Deskpro Object. Depending on where within the Deskpro UI the application is displayed, that is to say depending which Deskpro UI Component is acting as the container host for your application, the context will expose a list of events (for example, a ticket.reply
event) that the application can react to. The application is also given access to the data loaded by the hosting container and displayed in the Deskpro UI in the shape of a ContextDataObject.
The Application Context is useful when:
you need to retrieve the currently authenticated user
you want to access the data stored in the of its Deskpro Object or
you want to interact with the host ui container, for instance a Ticket Tab which shows your application which allows you to close it or activate it.
you need access to the data displayed in the context's Deskpro UI, for instance you need the primary email of the Person displayed in a CRM tab to pull additional information from a third party
You can access the context via property from the dpapp
application client your application receives. For reference, the context object is a concrete implementation of .
Here is a list of recipes that cover most of the usage scenarios:
to retrieve the authenticated user, read
to access the context object's custom fields , read
for interacting with the host ui , read
Here is a list of Ticket Context related events:
You can read more about the various data objects available for each Application Context and their schema in the