Apps Developer Guide (Old)
  • Introduction
  • Create your first app in 4 easy steps
  • Overview
    • How does it work ?
    • Documentation
    • Deskpro Apps Tool
  • SDK
    • The Application Manifest
      • Manifest Reference
    • Storing data
      • Storing ticket data
    • Accessing the Deskpro REST API
    • Accessing remote services
    • The Application Installer
    • Application Contexts
      • ContextDataObject Reference
    • Events
  • Guides
    • Create an Oauth2 integration
    • Using an API Key to read data
  • Application Context
    • Get the authenticated user
    • Access Custom Fields
    • Interacting with the Host UI Container
  • Application Container
    • How do I badge my app icon
  • HTTP
    • How do I use a remote web service
  • OAuth2
    • How do I customize OAuth2 requests
  • UI Patterns
    • How do I split my app into different screens
Powered by GitBook
On this page
  1. Application Context

Access Custom Fields

PreviousGet the authenticated userNextInteracting with the Host UI Container

Last updated 6 years ago

The Custom Fields feature give you another way of storing application data which is associated with the application context's Deskpro Object.

If you are not yet familiar with the concept of Custom Fields in Deskpro, head over to the official documentation:

You access Custom Fields through a , which is made available via the property of the application context:

    const { customFields } = this.props.dpapp.context;
    customFields.getField('myFieldId').then(value => console.log(value));

For setting the value of a field:

    const { customFields } = this.props.dpapp.context;
    customFields.setField('myFieldId', myValue).then(response => console.log(response.body));

The methods above allow you to retrieve the value of any custom field by its id. For custom fields which are created by your application and which are referred to by their alias, the custom fields client offers a set of similar methods.

If your application is adding new custom fields and you need to access them use the following method for reading:

    const { customFields } = this.props.dpapp.context;
    customFields.getAppField('myAlias').then(value => console.log(value));

For setting the value of a field:

    const { customFields } = this.props.dpapp.context;
    customFields.setAppField('myAlias', myValue).then(response => console.log(response.body));
https://support.deskpro.com/en/guides/admin-guide/ticket-fields-2/custom-fields
CustomFieldsClient
customFields