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

Fix Issue 1392 - New items are always created with the default content type if the list has multiple content types #1626

Merged
merged 1 commit into from
Sep 23, 2023

Conversation

NishkalankBezawada
Copy link
Contributor

Q A
Bug fix? [x]
New feature? [ ]
New sample? [ ]
Related issues? fixes #1392

What's in this Pull Request?

Fix for issue #1392
The site has a list called List1. List1 has multiple content types, CT1, CT2 and CT3, the default content type is CT1. All content types have different fields added to them. When the user opens the new form, and creates a new item, the new item's CT matches the one the user chooses on the sharepoint interface.

Expected behaviour

When contentTypeId is passed as property to Dynamic Form, New item should be created based on contentTypeId which is passed.

Solution

Èxtra check is done at method onSubmitClick while creating a new item, as below

const contentTypeIdField = "ContentTypeId";
contentTypeId !== undefined && contentTypeId.startsWith("0x01") ? objects[contentTypeIdField] = contentTypeId : objects;

New Item with CT scenario

Issue 1392 New Item with CT (2)

Edit item scenario

Issue 1392 Edit Scenario1

New item without CT Scenario

Issue 1392 New item without CT (1)

Thanks,
Nishkalank

@joaojmendes joaojmendes self-requested a review September 23, 2023 11:27
@joaojmendes joaojmendes self-assigned this Sep 23, 2023
@joaojmendes joaojmendes added the status:fixed-next-drop Issue will be fixed in upcoming release. label Sep 23, 2023
@joaojmendes joaojmendes added this to the 3.16.0 milestone Sep 23, 2023
@joaojmendes
Copy link
Collaborator

Hi, @NishkalankBezawada thank you very much for your PR.

@joaojmendes joaojmendes merged commit cf002d6 into pnp:dev Sep 23, 2023
1 check passed
@NishkalankBezawada NishkalankBezawada deleted the issue-1392 branch September 23, 2023 12:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:fixed-next-drop Issue will be fixed in upcoming release.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants