You can use Set-PnPContentType to associate an SPFx Form Customizer with a content type. This allows you to customize the forms (New, Edit, or Display) used with that content type.
There are two ways to do this:
- Apply to all forms (New, Edit, and Display): Use the convenience parameters
-FormClientSideComponentId and -FormClientSideComponentProperties. - Apply to a specific form type: Use the specific parameters for the form you want to target:
- Display Form:
-DisplayFormClientSideComponentId and -DisplayFormClientSideComponentProperties. - New Item Form:
-NewFormClientSideComponentId and -NewFormClientSideComponentProperties. - Edit Item Form:
-EditFormClientSideComponentId and -EditFormClientSideComponentProperties.
# Update all forms (New, Edit, and Display) at once
Set-PnPContentType -Identity "Project Document" -List "Projects" -FormClientSideComponentId "dfed9a30-ec25-4aaf-ae9f-a68f3598f13a" -FormClientSideComponentProperties '{ "someKey": "some value" }'
# Update ONLY the display form
Set-PnPContentType -Identity "Project Document" -List "Projects" -DisplayFormClientSideComponentId "dfed9a30-ec25-4aaf-ae9f-a68f3598f13a" -DisplayFormClientSideComponentProperties '{ "someKey": "some value" }'