Documenting field mappings in Qualtrics workflows can be tedious, especially when working with the Add Contacts and Transactions to XMD task that may include dozens of source and transaction fields. This free browser-based tool extracts your complete XMD transaction mapping configuration in seconds.
The Challenge
When working with the Add Contacts and Transactions to XMD task in Qualtrics Workflows, you regularly need to:
- Document which source fields map to which XM Directory data project fields
- Track field types (Contact data, Transaction data) across every row
- Compare configurations across environments (Dev, Test, and Prod)
- Create audit trails before deployment to production
- Share mapping documentation with your team for review
Manually copying this information is time-consuming and error-prone. A single missed field or incorrect field type mapping can cause XMD data loading failures in production.
The Solution
A simple JavaScript tool that runs directly in your browser and extracts all Add Contacts and Transactions to XMD field mappings instantly:
- Source field to Data Project field mappings
- Field type for every row (Contact data, Transaction data)
- Full field names without truncation
- Export to CSV, JSON, or clipboard
Watch the Demo
How to Use
Open the Add Contacts and Transactions to XMD Task
Navigate to your Qualtrics Workflow and open the Add Contacts and Transactions to XMD task. Make sure the field mapping table is visible on screen before running the script.
Open the Browser Console
Right-click anywhere on the mapping table and select Inspect or Inspect Element from the context menu.
In the developer tools panel that opens, click the Console tab.
Copy and Run the Extraction Script
Click the Copy Script button below, paste it into the console, and press Enter. The script runs immediately and prints a usage guide with all available commands.
Export Your Data
Call one of these export commands in the console:
downloadXMDTransactionCSV()
// Copy CSV to clipboard
copyXMDTransactionCSV()
// View as JSON
getXMDTransactionJSON()
// List all mappings in the console
listXMDTransactionRows()
The Script
// ============================================================================
// QUALTRICS XMD TRANSACTION MAPPING EXTRACTOR v3.0 (Resilient)
// Extracts field mappings from "Add contacts and transactions to XMD" task
// Uses stable data-testid attributes with fallbacks
// ============================================================================
// ============================================================================
// UTILITY: RESILIENT SELECTORS
// ============================================================================
const XMD_SELECTORS = {
table: [
'div[data-testid="data-mapper-table-test-id"]',
'div[role="grid"][aria-label="data-mapper-table"]'
],
rows: [
'div[data-testid^="data-mapper-table-test-id-row-"]',
'div[role="row"]:has(button[data-testid^="source-field-dropdown-"])'
],
sourceFieldButton: [
'button[data-testid^="source-field-dropdown-"]',
'button[role="combobox"][aria-haspopup="menu"]'
],
dataProjectFieldInput: [
'input[data-testid="destination-field-combo-input"]',
'div[data-testid^="destination-field-combo-"] input[type="text"]'
],
fieldTypeButton: [
'button[role="combobox"][aria-haspopup="listbox"]',
'button:has(span:contains("Contact data"), span:contains("Transaction data"))'
],
moreOptionsButton: [
'button[data-testid^="data-mapper-row-ellipsis-"]',
'button[aria-label="more"]'
]
};
function findElement(parent, selectorArray) {
for (const selector of selectorArray) {
try {
const element = parent.querySelector(selector);
if (element) return element;
} catch (e) {
continue;
}
}
return null;
}
function findElements(parent, selectorArray) {
for (const selector of selectorArray) {
try {
const elements = parent.querySelectorAll(selector);
if (elements.length > 0) return elements;
} catch (e) {
continue;
}
}
return [];
}
// ============================================================================
// EXTRACTION FUNCTION (Resilient)
// ============================================================================
function extractXMDTransactionMappings() {
console.log('\n🔍 Extracting XMD Transaction Mappings...\n');
const mappings = [];
// Find the main table
const table = findElement(document, XMD_SELECTORS.table);
if (!table) {
console.error('❌ XMD transaction table not found');
return mappings;
}
// Find all data rows (skip header row)
const rows = findElements(table, XMD_SELECTORS.rows);
if (rows.length === 0) {
console.warn('⚠️ No mapping rows found');
return mappings;
}
rows.forEach((row, index) => {
// Extract Source Field
let sourceField = '';
const sourceButton = findElement(row, XMD_SELECTORS.sourceFieldButton);
if (sourceButton) {
const span = sourceButton.querySelector('span._7CkrI, span');
sourceField = span?.textContent?.trim() || '';
}
// Extract Data Project Field
let dataProjectField = '';
const dataProjectInput = findElement(row, XMD_SELECTORS.dataProjectFieldInput);
if (dataProjectInput) {
dataProjectField = dataProjectInput.value || '';
}
// Extract Field Type
let fieldType = '';
const fieldTypeButton = findElement(row, XMD_SELECTORS.fieldTypeButton);
if (fieldTypeButton) {
const span = fieldTypeButton.querySelector('span._NQTya, span');
fieldType = span?.textContent?.trim() || '';
}
// Only add if at least source field exists
if (sourceField) {
mappings.push({
index: mappings.length + 1,
sourceField: sourceField,
dataProjectField: dataProjectField,
fieldType: fieldType
});
}
});
console.log(`✅ Found ${mappings.length} field mappings\n`);
return mappings;
}
// ============================================================================
// EXPORT FUNCTIONS
// ============================================================================
function downloadXMDTransactionCSV() {
const mappings = extractXMDTransactionMappings();
if (mappings.length === 0) {
console.error('❌ No mappings found to export');
return;
}
// Create CSV header
const headers = ['Index', 'Source Field', 'Data Project Field', 'Field Type'];
const csvRows = [headers];
// Add data rows
mappings.forEach(mapping => {
csvRows.push([
mapping.index,
mapping.sourceField,
mapping.dataProjectField,
mapping.fieldType
]);
});
// Convert to CSV string
const csvContent = csvRows.map(row =>
row.map(cell => `"${cell}"`).join(',')
).join('\n');
// Download
const blob = new Blob([csvContent], { type: 'text/csv;charset=utf-8;' });
const link = document.createElement('a');
const url = URL.createObjectURL(blob);
const timestamp = new Date().toISOString().slice(0, 19).replace(/:/g, '-');
link.setAttribute('href', url);
link.setAttribute('download', `xmd_transaction_mappings_${timestamp}.csv`);
link.style.visibility = 'hidden';
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
console.log(`✅ Downloaded CSV with ${mappings.length} field mappings`);
}
function copyXMDTransactionCSV() {
const mappings = extractXMDTransactionMappings();
if (mappings.length === 0) {
console.error('❌ No mappings found to copy');
return;
}
const headers = ['Index', 'Source Field', 'Data Project Field', 'Field Type'];
const csvRows = [headers];
mappings.forEach(mapping => {
csvRows.push([
mapping.index,
mapping.sourceField,
mapping.dataProjectField,
mapping.fieldType
]);
});
const csvContent = csvRows.map(row =>
row.map(cell => `"${cell}"`).join(',')
).join('\n');
navigator.clipboard.writeText(csvContent).then(() => {
console.log(`✅ Copied ${mappings.length} field mappings to clipboard`);
});
}
function getXMDTransactionJSON() {
const mappings = extractXMDTransactionMappings();
console.log(JSON.stringify(mappings, null, 2));
return mappings;
}
// ============================================================================
// VIEW FUNCTIONS
// ============================================================================
function listXMDTransactionRows() {
const mappings = extractXMDTransactionMappings();
console.log(`\n╔════════════════════════════════════════════════════════╗`);
console.log(`║ Current XMD Transaction Mappings: ${mappings.length}`);
console.log(`╚════════════════════════════════════════════════════════╝\n`);
if (mappings.length === 0) {
console.log('ℹ️ No mappings found\n');
return [];
}
mappings.forEach(mapping => {
console.log(`[${mapping.index - 1}] Source: ${mapping.sourceField} → Data Project: ${mapping.dataProjectField} (${mapping.fieldType})`);
});
console.log('');
return mappings;
}
// ============================================================================
// USAGE GUIDE
// ============================================================================
console.log(`
╔════════════════════════════════════════════════════════════════╗
║ QUALTRICS XMD TRANSACTION MAPPING EXTRACTOR v3.0 ║
║ (Resilient Edition - Future-Proof with Fallback Selectors) ║
╠════════════════════════════════════════════════════════════════╣
║ ║
║ 📥 EXTRACT FUNCTIONS: ║
║ downloadXMDTransactionCSV() - Download as CSV file ║
║ copyXMDTransactionCSV() - Copy to clipboard ║
║ getXMDTransactionJSON() - View as JSON ║
║ ║
║ 📋 VIEW FUNCTIONS: ║
║ listXMDTransactionRows() - List all mappings ║
║ ║
║ ✨ Features: ║
║ - Uses stable data-testid attributes ║
║ - Fallback selectors for future-proofing ║
║ - Handles missing fields gracefully ║
║ ║
╚════════════════════════════════════════════════════════════════╝
`);
CSV Output Format
The exported CSV includes four columns covering everything you need to document or compare an Add Contacts and Transactions to XMD configuration:
"1","Customer_Email","Email","Contact data"
"2","Customer_First_Name","First Name","Contact data"
"3","Transaction_Date","TransactionDate","Transaction data"
"4","Purchase_Amount","PurchaseAmount","Transaction data"
| Column | Description |
|---|---|
| Index | Row order in the mapping table, useful for spotting field order differences across environments |
| Source Field | The incoming field name from the data extractor task |
| Data Project Field | The target XM Directory field the source maps to |
| Field Type | Whether the field is mapped as Contact data or Transaction data |
Comparing Across Environments (Dev, Test, and Prod)
One of the most powerful use cases is comparing Add Contacts and Transactions to XMD configurations across different Qualtrics environments before deployment. Configuration drift between Dev, Test, and Prod is one of the most common causes of XMD data loading failures that are difficult to diagnose.
Extract from Development Environment
Open your workflow in the Dev environment, run the extraction script, and download the CSV. Save it as xmd_transaction_mappings_DEV.csv.
Extract from Test Environment
Repeat the process in Test and save as xmd_transaction_mappings_TEST.csv.
Extract from Production Environment
Extract from Prod and save as xmd_transaction_mappings_PROD.csv.
Compare with Pirai AI CSV Comparator
Upload two CSV files to the Pirai AI CSV Comparator to instantly identify mismatches. The tool shows differences row by row so you can spot missing fields, field type changes between Contact data and Transaction data, and naming inconsistencies without needing Excel or any external service. Your data stays in the browser.
What to Look for During Comparison
Common configuration drift patterns
- Missing fields : a source field present in Dev but absent in Prod
- Field type mismatches : a field mapped as Contact data in Dev but Transaction data in Prod
- Data Project field name changes : field renamed between environments without documentation
- Source field name discrepancies : casing or underscore differences between environments
- Index order differences : fields in a different sequence, which can affect downstream XMD processing
Use Cases
Workflow Documentation
Create comprehensive mapping records for team onboarding and knowledge transfer.
Environment Migrations
Compare configurations when promoting workflows from Test to Production.
Audit and Compliance
Maintain reproducible records of field mapping configurations for audit trails.
Template Creation
Document successful workflow patterns to replicate across projects.
Troubleshooting
Quickly identify mapping discrepancies when debugging data flow issues.
Pre-Deployment Validation
Verify all field mappings match before pushing changes to Production.
Key Features
Runs in Your Browser
Your data never leaves your machine. The script extracts information directly from the Qualtrics page you are viewing. No installation, no server, no account needed.
Multiple Export Formats
Download a CSV file for Excel or Google Sheets, copy CSV directly to the clipboard for quick pasting, or view the full JSON output for developer workflows.
Complete Field Information
Every row includes the field index (order), source field name, data project field name, and field type (Contact data or Transaction data). Nothing is truncated or omitted.
Best Practices
Version Control Your Exports
Save extracted CSVs with environment and date stamps so you have a full history of configuration changes:
xmd_transaction_mappings_TEST_2026-03-28.csv
xmd_transaction_mappings_DEV_2026-03-28.csv
Document Changes
When you find discrepancies between environments, note whether they are intentional. A field type change from Contact data to Transaction data may be deliberate, or it may be a deployment oversight.
Regular Audits
Extract and archive configurations monthly to catch configuration drift early, before it causes data pipeline failures.
Pre-Deployment Checklist
Always compare Dev/Test/Prod CSVs before deploying XMD workflow changes. Use the CSV Comparator to make this a fast, repeatable step in your deployment process.
Troubleshooting
No mapping rows found
Make sure you are on the Add Contacts and Transactions to XMD task configuration screen with the field mapping table visible. The script targets specific DOM selectors that only appear on that screen.
Empty CSV after export
Call downloadXMDTransactionCSV() or another export function directly. The v3.0 script calls the extraction function automatically each time an export command is run.
Script not working
Clear your browser console and paste the script again. Ensure you are using a modern browser (Chrome, Edge, or Firefox). Internet Explorer is not supported.
Automate Your Survey Workflow
Pirai AI converts Word, PDF, and Excel questionnaires into Qualtrics and 20+ other platforms automatically. No manual programming required.
Try Pirai AI Free