# Register FieldFormat plugin in v. 7.6.2

**URL:** https://discuss.elastic.co/t/register-fieldformat-plugin-in-v-7-6-2/240408
**Category:** Kibana
**Created:** [July 8, 2020, 5:13pm UTC](https://discuss.elastic.co/t/register-fieldformat-plugin-in-v-7-6-2/240408 "2020-07-08T17:13:45Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Elaak](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/elaak/32/55014_2.png) [@Elaak](https://discuss.elastic.co/u/Elaak)
#### Post date: [July 8, 2020, 5:13pm UTC](https://discuss.elastic.co/t/register-fieldformat-plugin-in-v-7-6-2/240408/1 "2020-07-08T17:13:45Z")

</div>

This is basically the same question as this post:

> [@Field Formatter registration Kibana 7.6.2](https://discuss.elastic.co/t/field-formatter-registration-kibana-7-6-2/228544):
>
> Hi, I attempted to register my plugin using this: [image] Here is how I used it: [image] But I get this error: I changed the code to this (passing an array with my field formatter): [image] However the page to edit field types comes up blank on kibana Can someone provide some insight as to what I can do to register my field formatter plugin?

But this one does not have a solution, at the very least the last post does not solve my issue. Although I believe there are typos in the last post also.

I am trying to upgrade my field format plugin to Elastic stack 7.6.2.

Since I have not grasped the new way to create plugins using Typescript, I tried to use the legacy implementation.

With the following code the field formatter is registered, but when I try to activate it for one field, I get an empty page similar to what is listed at the end of the first post here: [Field Formatter registration Kibana 7.6.2](https://discuss.elastic.co/t/field-formatter-registration-kibana-7-6-2/228544)

"plugins\truncateddialog\index.js"

```auto
    export default function (kibana) {
      return new kibana.Plugin({
        require: ['elasticsearch'],
        id: 'truncatedstringdialog',
        uiExports: {
          fieldFormats: [
            'plugins/truncatedstringdialog/public/truncatedmodal'
          ],
          injectDefaultVars(server) {
            const config = server.config();
            return {
              truncatedLength: config.get('truncatedstringdialog.maxlength')
            };
          }
        },

        config(Joi) {
          return Joi.object({
            enabled: Joi.boolean().default(true),
            maxlength: Joi.number().integer().default(50)
          }).default();
        }
      });
    };

```

"plugins\truncateddialog\public\truncatedmodal.js"

```auto
    import { npSetup, npStart } from 'ui/new_platform';

    export function TruncatedStringDialogProvider() {
      class TruncatedStringDialog extends FieldFormat {
        static id = 'truncatedstringdialog';
        static title = 'Truncated String Dialog';
        static fieldType = KBN_FIELD_TYPES.STRING;

        textConvert = val => {
          const length = 0;
          if (length > 0) {
            return trunc(val, {
              length: length + omission.length,
              omission,
            });
          }
          return val;
        };
        htmlConvert = (rawValue, field, hit) => {
          const length = 50;
          if (length > 0) {
            return '<button ' +
              'id="btn-' + hit['_id'] + '" ' +
              'data-document="' + hit['._id'] + '" ' +
              'data-field="fullModalStringDialog" ' +
              'data-content="' + rawValue + '">' +
              rawValue.substring(0, length) + ' ... ' +
              '</button>' +
              '<div id="dialog-modal"></div>'
          }
          return `<div>${rawValue}</div>`;
        }
      };

      return TruncatedStringDialog;
    }

    npSetup.plugins.data.fieldFormats.register([TruncatedStringDialogProvider]);
    npStart.plugins.data.fieldFormats.getType("truncatedstringdialog")

```

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [August 5, 2020, 5:14pm UTC](https://discuss.elastic.co/t/register-fieldformat-plugin-in-v-7-6-2/240408/2 "2020-08-05T17:14:06Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
