Report
After upgrading to EspoCRM 10.0.0 (also upgraded to 10.0.1), I encountered an issue in:
Administration → PDF Templates → Create/Edit Template
The entity fields appear correctly under Available Placeholders, but when any placeholder is selected:
The same issue was reproduced on a completely fresh EspoCRM 10.1.1 installation without custom entities or extensions. Console error
Uncaught TypeError: Cannot use 'in' operator to search for 'id' in undefined
at r._setMultipleInternal (espo-main.js:2419:16)
at r.setMultiple (espo-main.js:2406:19)
at a.<anonymous> (espo-main.js:14591:22)
at c (bullbone.js:352:63)
at F (bullbone.js:332:17)
at l (bullbone.js:48:22)
at n.trigger (bullbone.js:319:9)
at a.trigger (bullbone.js:3897:28)
at HTMLSelectElement.<anonymous> (espo-main.js:14744:16)
at HTMLSelectElement.dispatch (jquery.js:5146:27)
An additional console warning was also displayed:
loader.js:353 Lib without id. Cause identified
The error occurs in the model method:
_setMultipleInternal(e,t){
this.idAttribute in e && (this.id=e[this.idAttribute]);
In this case, e is undefined, so JavaScript throws an exception when evaluating:
this.idAttribute in e
It appears that selecting a PDF placeholder causes setMultiple() to be called with an undefined value.
Temporary workaround
I added a defensive check inside _setMultipleInternal:
_setMultipleInternal(e,t){
if (!e || typeof e !== "object") {
return this;
}
this.idAttribute in e && (this.id=e[this.idAttribute]);
In the minified client/lib/espo-main.js file, the change was:
_setMultipleInternal(e,t){if(!e||"object"!=typeof e)return this;this.idAttribute in e&&(this.id=e[this.idAttribute]);
After replacing the file and clearing the browser/site cache, the placeholder selector started working correctly.
Steps to reproduce
EspoCRM version: 10.1.1
Browser: Chrome / Edge
Issue reproduced on: upgraded installation and fresh installation
Custom extensions: none on fresh installation
The defensive check prevents the crash, but the underlying issue appears to be that an undefined value is being passed to Model.setMultiple() when the PDF placeholder dropdown changes.
After upgrading to EspoCRM 10.0.0 (also upgraded to 10.0.1), I encountered an issue in:
Administration → PDF Templates → Create/Edit Template
The entity fields appear correctly under Available Placeholders, but when any placeholder is selected:
- the selected value immediately becomes empty;
- the placeholder code is not displayed in the field on the right;
- a JavaScript error appears in the browser console.
The same issue was reproduced on a completely fresh EspoCRM 10.1.1 installation without custom entities or extensions. Console error
Uncaught TypeError: Cannot use 'in' operator to search for 'id' in undefined
at r._setMultipleInternal (espo-main.js:2419:16)
at r.setMultiple (espo-main.js:2406:19)
at a.<anonymous> (espo-main.js:14591:22)
at c (bullbone.js:352:63)
at F (bullbone.js:332:17)
at l (bullbone.js:48:22)
at n.trigger (bullbone.js:319:9)
at a.trigger (bullbone.js:3897:28)
at HTMLSelectElement.<anonymous> (espo-main.js:14744:16)
at HTMLSelectElement.dispatch (jquery.js:5146:27)
An additional console warning was also displayed:
loader.js:353 Lib without id. Cause identified
The error occurs in the model method:
_setMultipleInternal(e,t){
this.idAttribute in e && (this.id=e[this.idAttribute]);
In this case, e is undefined, so JavaScript throws an exception when evaluating:
this.idAttribute in e
It appears that selecting a PDF placeholder causes setMultiple() to be called with an undefined value.
Temporary workaround
I added a defensive check inside _setMultipleInternal:
_setMultipleInternal(e,t){
if (!e || typeof e !== "object") {
return this;
}
this.idAttribute in e && (this.id=e[this.idAttribute]);
In the minified client/lib/espo-main.js file, the change was:
_setMultipleInternal(e,t){if(!e||"object"!=typeof e)return this;this.idAttribute in e&&(this.id=e[this.idAttribute]);
After replacing the file and clearing the browser/site cache, the placeholder selector started working correctly.
Steps to reproduce
- Install EspoCRM 10.1.1.
- Go to Administration → PDF Templates.
- Create a new PDF Template.
- Select an entity such as Account.
- Open Available Placeholders.
- Select any field, such as Name or City.
- The selected placeholder disappears and no placeholder code is generated.
- Check the browser console for the error above.
EspoCRM version: 10.1.1
Browser: Chrome / Edge
Issue reproduced on: upgraded installation and fresh installation
Custom extensions: none on fresh installation
The defensive check prevents the crash, but the underlying issue appears to be that an undefined value is being passed to Model.setMultiple() when the PDF placeholder dropdown changes.

Comment