Did you find this guide helpful?
Some test text!
Salesforce / Guides / Fill form fiellds
You can access and fill any form field by its field id:
// config.js
const { documentViewer, annotationManager } = instance.Core;
documentViewer.addEventListener('documentLoaded', () => {
documentViewer.getAnnotationsLoadedPromise().then(() => {
const fieldManager = annotationManager.getFieldManager();
const field = fieldManager.getField(fieldId);
field.setValue('new value');
});
});
You can also iterate over all fields using the forEachField function of FieldManager.
// config.js
const { documentViewer, annotationManager } = instance.Core;
documentViewer.addEventListener('documentLoaded', () => {
documentViewer.getAnnotationsLoadedPromise().then(() => {
// iterate over fields
const fieldManager = annotationManager.getFieldManager();
fieldManager.forEachField(field => {
console.log(field.getValue());
field.setValue('new value');
});
});
});
The fieldChanged event is fired any time the value of a form field changes.
// config.js
const { annotationManager } = instance.Core;
annotationManager.addEventListener('fieldChanged', (field, value) => {
console.log(`Field changed: ${field.name}, ${value}`);
});
Trial setup questions? Ask experts on Discord
Need other help? Contact Support
Pricing or product questions? Contact Sales