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

Dynamic Form - Error get field informations TypeError: item[field.InternalName].forEach is not a function #1568

Closed
ravaney opened this issue Jun 26, 2023 · 6 comments · Fixed by #1614 or #1709
Labels
status:fixed-next-drop Issue will be fixed in upcoming release. type:bug
Milestone

Comments

@ravaney
Copy link

ravaney commented Jun 26, 2023

Thank you for reporting an issue, suggesting an enhancement, or asking a question. We appreciate your feedback - to help the team understand your
needs please complete the below template to ensure we have the details to help. Thanks!

Please check out the documentation to see if your question is already addressed there. This will help us ensure our documentation is up to date.

Category

[ ] Enhancement

[x ] Bug

[ ] Question
Does this work across multiple sharepoint sites (providing the web absolute url). My form renders on the default site on sharepoint, but if I use another site and provide the site relative url as a prop, it doesn't render.

Version 3.14.0

Expected / Desired Behavior / Question

a rendered form for different field types

Observed Behavior

loading bar, no form rendered

Steps to Reproduce

                    context={webPartContext}
                    listId={listId.toString()}
                    listItemId={file.ListItemAllFields.ID}
                    onCancelled={() => { console.log('cancelled') }}
                    onBeforeSubmit={async (listItem) => { return false; }}
                    onSubmitError={(listItem, error) => { console.log(error) }}
                    onSubmitted={() => { console.log('submitted') }}
                    webAbsoluteUrl={siteAbsoluteUrl}

https://company.sharepoint.us/sites/originalSite .... // this works fine without web absolute url

if I change the site to https://company.sharepoint.us/sites/other-site from organization // I get the error with or without the webAbsoluteUrl as a prop

Thanks!

@ghost
Copy link

ghost commented Jun 26, 2023

Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.

@ghost ghost added the Needs: Triage 🔍 label Jun 26, 2023
@github-actions
Copy link

Thank you for submitting your first issue to this project.

@NishkalankBezawada
Copy link
Contributor

Hi @ravaney

I have tried to reproduce the reported issue, but it seems to work well for me.
Please refer my sample as below.
https://github.com/NishkalankBezawada/SPFx-research

I have used,
@microsoft/generator-sharepoint@1.15.0
node -v 16.18.1
npm -v 8.19.2
and below are the pnp modules used for the project
+-- @pnp/graph@3.16.0
+-- @pnp/logging@3.16.0
+-- @pnp/queryable@3.16.0
+-- @pnp/sp@3.16.0
+-- @pnp/spfx-controls-react@3.14.0

can you try to pass the actual list guid, and the list item id directly as below

                 <DynamicForm
                    context={webPartContext}
                    listId={aa553012-2109-4431-ad7f-a57a32800dc2}
                    listItemId={1}
                    onCancelled={() => { console.log('cancelled') }}
                    onBeforeSubmit={async (listItem) => { return false; }}
                    onSubmitError={(listItem, error) => { console.log(error) }}
                    onSubmitted={() => { console.log('submitted') }}
                    webAbsoluteUrl={siteAbsoluteUrl}
                 >
                </DynamicForm>

and let me know the results.

Thanks,
Nishkalank

@IRRDC
Copy link
Contributor

IRRDC commented Aug 3, 2023

I just noticed the same error and it happens when you include TaxonomyFieldTypeMulti fields where the values are in a sub-array called results while the code tries to directly access the items of the object and not the sub-array:

Zwischenablage01
Zwischenablage02

@IRRDC
Copy link
Contributor

IRRDC commented Sep 8, 2023

Could someone please check the PR. It's just two lines of code that have changed and it would be really helpful to have the fix included in one of the next releases.

@michaelmaillot michaelmaillot added status:working-on-it Known issue / feature being addressed. Will use other "status:*" labels & comments for more detail. type:bug and removed Needs: Triage 🔍 labels Sep 13, 2023
@joelfmrodrigues joelfmrodrigues added this to the 3.16.0 milestone Sep 25, 2023
@joelfmrodrigues
Copy link
Collaborator

Hey all, reopening and tagging to be fixed in the next release

@joelfmrodrigues joelfmrodrigues added status:fixed-next-drop Issue will be fixed in upcoming release. and removed status:working-on-it Known issue / feature being addressed. Will use other "status:*" labels & comments for more detail. labels Sep 25, 2023
@AJIXuMuK AJIXuMuK mentioned this issue Nov 25, 2023
IRRDC added a commit to IRRDC/sp-dev-fx-controls-react that referenced this issue Dec 4, 2023
Previous fix for pnp#1568 was incomplete. New expanded fix for pnp#1717. DefaultValue can be an object too.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment