# Re-use a smart field logic

This example shows you how to re-use the logic of your smart field.

Here, we created a `fullname` field that concatenates first and last name. We'll create our own function and export it for use elsewhere in our admin backend.

![](/files/-M4Z0XYTrDpuCqrTrnTE)

## Requirements

* An admin backend running on forest-express-sequelize

## How it works

### Directory: /models

This directory contains the `users.js` where the model is defined.&#x20;

{% code title="/models/users.js" %}

```javascript
module.exports = (sequelize, DataTypes) => {
  const { Sequelize } = sequelize;

  const Users = sequelize.define('users', {
    firstName: {
      type: DataTypes.STRING,
    },
    lastName: {
      type: DataTypes.STRING,
    },
  }, {
    tableName: 'users',
    timestamps: false,
    schema: process.env.DATABASE_SCHEMA,
  });

  return  Users;
};
```

{% endcode %}

### Directory: /forest

This directory contains the `users.js` file where the Smart Field `fullname`is declared.

```javascript
const { collection } = require('forest-express-sequelize');

// create our own module
const getFullname = (user) => {
  return `${user.firstName} ${user.lastName}`;
};


collection('users', {
  fields: [{
    field: 'fullname',
    type: 'String',
    get: getFullname,
  }],
});

// export it to use it somewhere else in our admin backend
module.exports = {
  getFullname,
};
```

{% hint style="info" %}
You can now require this module everywhere in your admin backend:

```
const { getFullname } = require('../forest/user');
```

{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.forestadmin.com/woodshop/how-tos/re-use-a-smart-field-logic.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
