Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: DynamicForm does not properly load lookup field when the webpart is not in the same site as the lists. #1930

Open
EdAlexander opened this issue Jan 10, 2025 · 1 comment

Comments

@EdAlexander
Copy link

EdAlexander commented Jan 10, 2025

When using DynamicForm component I set the webAbsoluteUrl to refer to the site where the list is located. If the list includes a lookup field and the webpart is running in a different site that webAbsoluteUrl, the lookup field fails to load lookup options and displays the error "Cannot read properties of undefined (reading 'TypeAsString')"

I assume that I need to pass a different context to the component. Any guidance on how best to do that? I do have an spfi object that corresponds to the webAbsolutUrl site.

<DynamicForm
webAbsoluteUrl={this.state.matterSiteUrl}
listId={this.state.matterListId}
onCancelled={() => { this.setState({ showNewMatter: false }) }}
onBeforeSubmit={this._matterOnBeforeSubmit}
onSubmitError={(listItem, error) => { console.log(error.message); }}
onSubmitted={async (listItemData) => {
await this._readMatterListItems();
await this._getSelectedMatter(this.state.matterlist);
}}
context={this.props.context}
/>

image

Category

[ ] Enhancement

[X] Bug

[ ] Question

Version

Please specify what version of the library you are using: [ 3.20.0 ]

@EdAlexander
Copy link
Author

A little more info...

Error get Items TypeError: Cannot read properties of undefined (reading 'TypeAsString')
    at SPService.<anonymous> (c:\Users\ed.alexander\source\repos\EACPartnersMatterManager\dist\node_modules\@pnp\spfx-controls-react\lib\services\SPService.js:307:42)
    at step (c:\Users\ed.alexander\source\repos\EACPartnersMatterManager\dist\node_modules\@pnp\spfx-controls-react\lib\services\SPService.js:32:1)
    at Object.next (c:\Users\ed.alexander\source\repos\EACPartnersMatterManager\dist\node_modules\@pnp\spfx-controls-react\lib\services\SPService.js:13:46)
    at c:\Users\ed.alexander\source\repos\EACPartnersMatterManager\dist\node_modules\@pnp\spfx-controls-react\lib\services\SPService.js:7:1
    at new Promise (<anonymous>)
    at __webpack_modules__.19169.__awaiter (c:\Users\ed.alexander\source\repos\EACPartnersMatterManager\dist\node_modules\@pnp\spfx-controls-react\lib\services\SPService.js:3:1)
    at __webpack_modules__.19169.SPService.getListItems (c:\Users\ed.alexander\source\repos\EACPartnersMatterManager\dist\node_modules\@pnp\spfx-controls-react\lib\services\SPService.js:280:1)
    at ListItemPicker.<anonymous> (c:\Users\ed.alexander\source\repos\EACPartnersMatterManager\dist\node_modules\@pnp\spfx-controls-react\lib\controls\listItemPicker\ListItemPicker.js:142:1)
    at step (c:\Users\ed.alexander\source\repos\EACPartnersMatterManager\dist\node_modules\@pnp\spfx-controls-react\lib\controls\listItemPicker\ListItemPicker.js:58:1)
    at Object.next (https://localhost:4321/dist/matter-manager-web-part.js:110280:53) {stack: 'TypeError: Cannot read properties of undefine…21/dist/matter-manager-web-part.js:110280:53)', message: "Cannot read properties of undefined (reading 'TypeAsString')"}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant