Embedded Content Troubleshooting
This article covers common issues when injecting custom HTML into ProcessFactorial Forms using window.pfFormsEngine.v1.
pfFormsEngine.v1 not found on window
Error message (sample)
Symptoms
- The JavaScript console shows this error when your script attempts to access
window.pfFormsEngine.v1. - Injected HTML does not appear and
setValue/getValuecalls fail.
Root cause
The ProcessFactorial Forms scripts have not finished loading, or the form snippet is not embedded on the current page.
Resolution
- Verify the form snippet
<script>tag is present and loading correctly (check the Network tab for 404s or errors). - If your code runs before the form scripts load, wait for the form to initialize by calling
await window.pfFormsEngine.v1.whenReady(15000)instead of accessing.v1directly. - Poll for
window.pfFormsEnginewith a retry loop if you must run code before the form is guaranteed to be ready.
whenReady(...) returns false
Error message (sample)
Symptoms
- The Promise returned by
whenReady(15000)resolves tofalse. - Injected content or API calls that depend on the form being ready do not work.
Root cause
The form did not complete initialization within the specified timeout. This can happen if:
- An error occurred during form loading (check the console and Network tab).
- The timeout value is too short for the form's complexity or network conditions.
- The form snippet's
data-base-urlor token is invalid, preventing the form from loading.
Resolution
- Increase the timeout value — complex forms with many pages or reference data may need longer than the default 10 seconds.
- Check the browser console for other errors during form initialization.
- Verify the form snippet
data-base-urland token are correct (re-export from the configuration portal if needed).
InjectHTML fails with "Field wrapper not found"
Error message (sample)
Symptoms
InjectHTMLreturns an object withinjected: falseinstead of an HTMLElement.- The target field area remains empty or shows the original placeholder.
Root cause
The fieldId passed to InjectHTML does not correspond to an existing field on the current page, or the field is inside a repeating/grouped section and the required groupCode/groupIndex parameters were omitted.
Resolution
- Verify you are using the correct placeholder
fieldId. The field ID can be found in the form designer or by inspecting the DOM for thedata-fieldidattribute on the target element. - If the field exists inside a repeating section (grid/group), you must also pass the
groupCodeandgroupIndexparameters:
- Ensure the target field is rendered on the currently visible page — fields on hidden tabs or pages are not in the DOM and cannot be found.
setValueByQuery returns "No matching reference data found"
Error message (sample)
Symptoms
setValueByQuerydoes not set the lookup field value.- The returned object has
handled: false.
Root cause
One of the following:
- The target field is not on the currently visible page — reference data is lazy-loaded per page.
- The target field is a typeahead/autocomplete field, not a
<select>dropdown. - The filter attribute (e.g.
productnumber) is not in the Additional Display Attributes of the lookup configuration, so it's not available in the reference data API response. - No record matches the provided query.
Resolution
- Ensure the target field is on the currently visible page before calling
setValueByQuery. - Check that the field is a standard
<select>dropdown (not a typeahead). - Verify the filter attribute is included in the lookup's Additional Display Attributes in the configuration portal.
- If the query is correct but no match is found, the record may not exist in the reference data — use
setValuewith a known key value instead.
Notes and references
- See Injecting Custom HTML for the full API reference and examples.
- See Parent App Integration for setting up
window.pfFormsEnginein your application.