Skip to main content

Copying Prompt Value Mappings

Ever wondered if it's possible to copy Prompt Value Mappings from one field to another when setting up a Source Format? ๐Ÿค” Sure would be handy when mapping, say all the countries on earth over and over!

There's a feature request for that, but in the meantime, it's possible to use your browser's developer tools to copy mappings.

This article includes step-by-step directions for Firefox, as Firefox has a graphical tool to edit and resend network requests.

Chrome has no such feature, but it does allow copying a request as code that can be run in a terminal. If you are not comfortable with that, Firefox is recommended.

Overview

The saving grace of the prompt mapping page is that the entire set of source:destination prompts is sent to Slate in a simple format each time you click Save in a mapping dialog.

Using Firefox's developer tools, we can manually re-send mapping data from Field A for Field B.

Method 1

Steps

We'll use a Country field as our example. Screenshots can be found below the steps.

  1. Map the countries. You can't avoid doing it at least once. ๐Ÿ™‚
  2. Click into the mappings dialog and open your developer tools Network tab (Ctrl + Shift + E in Firefox).
  3. Save the mappings. A POST request will be logged in the network tab.
  4. Right-click the request and select Edit and Resend.
  5. Edit the src URL parameter. In this example, change it from Country1 to Country2.
  6. Press Send. Your second field should now be mapped! Refresh the page to see the counters change.

Screenshots.

Step 4: Edit and resend the POST request

image.png

Step 5: Edit the src Parameter

image.png

Method 2

Tip: Steps 1-3 are the same.

Steps

We'll use a Country field as our example. Screenshots can be found below the steps.

  1. Map the countries. You can't avoid doing it at least once. ๐Ÿ™‚
  2. Click into the mappings dialog and open your developer tools Network tab (Ctrl + Shift + E in Firefox).
  3. Save the mappings. A POST request will be logged in the network tab.
  4. Click into the POST request, go to the Request tab, and copy the raw request.
  5. Click into your second country field and save the empty mapping. This will log a second POST request.
  6. Right-click your second POST request and select the "Edit and Resend" feature.
  7. Scroll to the bottom of the New Request pane and replace the Body with the body we copied earlier.
  8. Click Send. Your second field should now be mapped! Refresh the page to see the counters change.

Step 5 could be skipped if you hand-craft the URL to point at your second field, but I find this method to be easiest.

It's a bit tricky, but you can edit the raw POST body to remove source values you don't want.

Screenshots

Step 4: Capture a set of mappings

image.png

Step 6: Edit and resend the POST request

image.png

Step 7: Paste data from step 4

image.png