Forsta HX Platform - API Scripting Guide
Standard Forsta methods with practical medical survey examples
Welcome to the Forsta HX Scripting Guide
This comprehensive guide covers everything you need to know about scripting in the Forsta HX Platform.
🇪🇺 Euro SaaS Platform Compatibility
This guide has been optimized for the Forsta HX Euro SaaS Platform. Key considerations:
- Data Storage: Use platform-native data collection; avoid localStorage/sessionStorage (GDPR)
- Quotas & Routing: Configure through platform settings, not custom JavaScript redirects
- Submission: Platform handles data submission automatically; no custom AJAX needed
- API Methods: Use Forsta API methods (with quotes:
f('Qid')) for data operations
Quick Navigation
Getting Started
Core Scripting
Most Used Methods
// Get all option codes for a question
var codes = f('BQ4c').domainValues();
// Check if specific option is selected
if (f('AQ1').item('3').toBoolean()) {
f('AQ1a').show();
}
// Calculate sum from selected checkboxes
var total = 0;
codes.forEach(function(code) {
if (f('BQ4c').item(code).toBoolean()) {
total += f('BQ4c').item(code).toNumber();
}
});
f('TotalSpend').set(total);