Tray Embedded / Advanced Topics / Data Mapping (Embedded) / Using Config Slots

Using Config Slots

Overview

There may be some cases where it is too restrictive for your End Users to only be able to choose from a pre-configured list of fields.

For example your End Users might be using different MySQL database tables with different field names and you want them to be able to name the fields to be mapped to themselves.

To do this you can follow the usual procedure for data mapping, as outlined in the Hardcoded Example.

The extra key steps are:

1. Add an extra config data variable to your mapping script:

This should be called something similar to userMappings:

And it should be an array:

IMPORTANT!: You do not need to adjust the actual mapping script.

2. Set the user mappings variable screen in the Solution Editor

You will need the End User to set the available fields before the actual mappings:

3. Set the appropriate data mapping service to use the config slot

To extend the Stripe use case from the Hardcoded Example we can leave the first service as is:

But then for service 2 we can specify that it uses the userMappings config slot:

End User experience

When an End User runs the Config Wizard they can first of all add a list of fields for the service to be mapped to:

These fields will then be available when setting up the actual mappings: