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.
- Map the countries. You can't avoid doing it at least once. ๐
- Click into the mappings dialog and open your developer tools Network tab (Ctrl + Shift + E in Firefox).
- Save the mappings. A POST request will be logged in the network tab.
- Right-click the request and select Edit and Resend.
- Edit the
src
URL parameter. In this example, change it from Country1 to Country2. - 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
Step 5: Edit the src Parameter
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.
- Map the countries. You can't avoid doing it at least once. ๐
- Click into the mappings dialog and open your developer tools Network tab (Ctrl + Shift + E in Firefox).
- Save the mappings. A POST request will be logged in the network tab.
- Click into the POST request, go to the Request tab, and copy the raw request.
- Click into your second country field and save the empty mapping. This will log a second POST request.
- Right-click your second POST request and select the "Edit and Resend" feature.
- Scroll to the bottom of the New Request pane and replace the Body with the body we copied earlier.
- 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.
No Comments