Reproduction steps: Create a new campaign with the following character sheet: <span>Output</span><input type="text" name="attr_output">
<br>
<fieldset class="repeating_test">
<span>Input value (don't change)</span><input type="checkbox" disabled='disabled' name="attr_input" value="1" checked="true">
<br>
<span>Trigger - toggle to update output</span><input type="checkbox" name="attr_trigger" value="1">
<br>
<span>API Trigger - toggle to update output via API</span><input type="checkbox" name="attr_api_trigger" value="1">
</fieldset>
<script type="text/worker">
on("change:repeating_test:trigger", function(eventInfo) {
const prefix = eventInfo.sourceAttribute.match(/repeating_test_[^_]+_/)[0];
const inputAttrName = `${prefix}input`;
getAttrs([inputAttrName], function(values) {
log('setting output value using sheet worker');
log(values[inputAttrName]);
setAttrs({output:values[inputAttrName]});
})
});
</script> and the following API script: on('change:attribute', (attr) => {
const match = attr.get('name').match(/(repeating_test_[^_]+_)api_trigger/);
if (match) {
const prefix = match[1];
const charId = attr.get('characterid');
let triggerAttr = findObjs({type:'attribute', name: `${prefix}trigger`, characterid:charId})[0];
if (!triggerAttr) {
triggerAttr = createObj('attribute', {name:`${prefix}trigger`, characterid:charId, current:'0'});
}
const currentVal = triggerAttr.get('current');
triggerAttr.setWithWorker('current', (currentVal === 0 || currentVal === '0') ? 'on' : '0');
}
}); then load the campaign up and do the following: Create a new character Open the character sheet Click the button to add a new repeating item In the new repeating item, click on the "Trigger" checkbox, Observe that the value of the Output text field is changed to reflect the value of the Input checkbox based on its default value Delete the value in the Output text field Click on the "API trigger" checkbox. Expected behaviour: The "Output" text field should be populated with the value "1" as read from the "Input" checkbox's default value Actual behaviour: The "Output" text field remains blank. Looking at the logging in the API console you will be able to see that the sheet worker script did fire, but when it attempted to read the value of the input checkbox using "getAttrs" it received "undefined" instead of the default value. Remarks: This behaviour is confined to repeating sections - reading default values from top-level fields works as expected This is not confined to checkboxes - the API sheetworkers can't read any default values within repeating sections Although this might seem a bit obscure when presented as a minimal testcase, this is actually pretty significant for real-world character sheets. There are many places on the Shaped sheet, for example, that use default values within repeating sections, and all of these will corrupt the sheet data with inaccurate values if the API happens to modify anything that triggers sheetworkers in these sections.