| external help file | Rnwood.Dataverse.Data.PowerShell.Cmdlets.dll-Help.xml |
|---|---|
| Module Name | Rnwood.Dataverse.Data.PowerShell |
| online version | |
| schema | 2.0.0 |
Creates or updates a form in a Dataverse environment.
Set-DataverseForm -Id <Guid> [-Entity <String>] [-Name <String>] [-FormType <FormType>] [-Description <String>]
[-IsActive] [-IsDefault] [-FormPresentation <FormPresentation>] [-PassThru] [-Publish]
[-Connection <ServiceClient>] [-ProgressAction <ActionPreference>] [-WhatIf] [-Confirm] [<CommonParameters>]
Set-DataverseForm -Id <Guid> [-Entity <String>] [-Name <String>] [-FormType <FormType>]
-FormXmlContent <String> [-Description <String>] [-IsActive] [-IsDefault]
[-FormPresentation <FormPresentation>] [-PassThru] [-Publish] [-Connection <ServiceClient>]
[-ProgressAction <ActionPreference>] [-WhatIf] [-Confirm] [<CommonParameters>]
Set-DataverseForm -Entity <String> -Name <String> -FormType <FormType> [-Description <String>] [-IsActive]
[-IsDefault] [-FormPresentation <FormPresentation>] [-PassThru] [-Publish] [-Connection <ServiceClient>]
[-ProgressAction <ActionPreference>] [-WhatIf] [-Confirm] [<CommonParameters>]
Set-DataverseForm -Entity <String> -Name <String> -FormType <FormType> -FormXmlContent <String>
[-Description <String>] [-IsActive] [-IsDefault] [-FormPresentation <FormPresentation>] [-PassThru] [-Publish]
[-Connection <ServiceClient>] [-ProgressAction <ActionPreference>] [-WhatIf] [-Confirm] [<CommonParameters>]
The Set-DataverseForm cmdlet creates or updates form definitions in a Dataverse environment. When creating a form, you must specify the entity, name, and form type. When updating, you specify the form ID. The cmdlet supports both simple property-based updates and complete FormXml replacement. Forms can be optionally published after creation/update.
Use this cmdlet for form creation and basic property updates. For detailed form structure manipulation (tabs, sections, controls), use the specialized form management cmdlets.
PS C:\> Get-DataverseConnection -Url https://myorg.crm.dynamics.com -Interactive -SetAsDefault
PS C:\> $formId = Set-DataverseForm -Entity 'contact' -Name 'Custom Contact Form' -FormType 'Main' -PassThru
PS C:\> Write-Host "Created form with ID: $formId"Creates a new main form for the contact entity with minimal configuration.
PS C:\> Get-DataverseConnection -Url https://myorg.crm.dynamics.com -Interactive -SetAsDefault
PS C:\> Set-DataverseForm -Entity 'account' -Name 'Account Quick Create' -FormType 'QuickCreate' -Description 'Quick create form for accounts' -IsActive -PassThruCreates a new quick create form with a description and marks it as active.
PS C:\> Get-DataverseConnection -Url https://myorg.crm.dynamics.com -Interactive -SetAsDefault
PS C:\> $formId = 'a1234567-89ab-cdef-0123-456789abcdef'
PS C:\> Set-DataverseForm -Id $formId -Name 'Updated Form Name' -Description 'Updated description' -IsDefaultUpdates the name, description, and sets the form as default for its entity.
PS C:\> Get-DataverseConnection -Url https://myorg.crm.dynamics.com -Interactive -SetAsDefault
PS C:\> $formXml = Get-Content -Path 'CustomForm.xml' -Raw
PS C:\> Set-DataverseForm -Entity 'contact' -Name 'Advanced Form' -FormType 'Main' -FormXmlContent $formXml -PublishCreates a new form using custom FormXml content and publishes it immediately.
PS C:\> Get-DataverseConnection -Url https://myorg.crm.dynamics.com -Interactive -SetAsDefault
PS C:\> $newFormXml = Get-Content -Path 'UpdatedForm.xml' -Raw
PS C:\> Set-DataverseForm -Id $formId -FormXmlContent $newFormXml -PublishUpdates an existing form with new FormXml content and publishes the changes.
PS C:\> Get-DataverseConnection -Url https://myorg.crm.dynamics.com -Interactive -SetAsDefault
PS C:\> # Create basic form
PS C:\> $formId = Set-DataverseForm -Entity 'contact' -Name 'My Custom Form' -FormType 'Main' -PassThru
PS C:\> # Add a tab
PS C:\> $tabId = Set-DataverseFormTab -FormId $formId -Name 'CustomTab' -Label 'Custom Information' -PassThru
PS C:\> # Add a section to the tab
PS C:\> $sectionId = Set-DataverseFormSection -FormId $formId -TabName 'CustomTab' -Name 'CustomSection' -Label 'Additional Details' -PassThru
PS C:\> # Add controls to the section
PS C:\> Set-DataverseFormControl -FormId $formId -TabName 'CustomTab' -SectionName 'CustomSection' -DataField 'description' -Label 'Notes'
PS C:\> # Publish the form
PS C:\> Set-DataverseForm -Id $formId -PublishDemonstrates creating a form and then customizing it with specialized form cmdlets.
DataverseConnection instance obtained from Get-DataverseConnection cmdlet, or string specifying Dataverse organization URL (e.g. http://server.com/MyOrg/). If not provided, uses the default connection set via Get-DataverseConnection -SetAsDefault.
Type: ServiceClient
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseDescription of the form
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseLogical name of the entity/table for the form
Type: String
Parameter Sets: Update, UpdateWithXml
Aliases: EntityName, TableName, ObjectTypeCode
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseType: String
Parameter Sets: Create, CreateWithXml
Aliases: EntityName, TableName, ObjectTypeCode
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseForm presentation type
Type: FormPresentation
Parameter Sets: (All)
Aliases:
Accepted values: ClassicForm, AirForm, ConvertedICForm
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseForm type
Type: FormType
Parameter Sets: Update, UpdateWithXml
Aliases:
Accepted values: Dashboard, AppointmentBook, Main, MiniCampaignBO, Preview, MobileExpress, QuickViewForm, QuickCreate, Dialog, TaskFlowForm, InteractionCentricDashboard, Card, MainInteractiveExperience, ContextualDashboard, Other, MainBackup, AppointmentBookBackup, PowerBIDashboard
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseType: FormType
Parameter Sets: Create, CreateWithXml
Aliases:
Accepted values: Dashboard, AppointmentBook, Main, MiniCampaignBO, Preview, MobileExpress, QuickViewForm, QuickCreate, Dialog, TaskFlowForm, InteractionCentricDashboard, Card, MainInteractiveExperience, ContextualDashboard, Other, MainBackup, AppointmentBookBackup, PowerBIDashboard
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseComplete FormXml content for the form
Type: String
Parameter Sets: UpdateWithXml, CreateWithXml
Aliases: FormXml, Xml
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseID of the form to update
Type: Guid
Parameter Sets: Update, UpdateWithXml
Aliases: formid
Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: FalseWhether the form is active (default: true when creating)
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseWhether this form is the default form for the entity
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseName of the form
Type: String
Parameter Sets: Update, UpdateWithXml
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseType: String
Parameter Sets: Create, CreateWithXml
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseReturn the form ID after creation/update
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseControls how progress information is displayed during cmdlet execution.
Type: ActionPreference
Parameter Sets: (All)
Aliases: proga
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalsePublish the form and entity after creation/update
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalsePrompts you for confirmation before running the cmdlet.
Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseShows what would happen if the cmdlet runs. The cmdlet is not run.
Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
Form Types Available:
- Dashboard (0) - Dashboard forms
- AppointmentBook (1) - Appointment book forms
- Main (2) - Main entity forms
- MiniCampaignBO (3) - Mini campaign forms
- Preview (4) - Preview forms
- MobileExpress (5) - Mobile express forms
- QuickViewForm (6) - Quick view forms
- QuickCreate (7) - Quick create forms
- Dialog (8) - Dialog forms
- TaskFlowForm (9) - Task flow forms
- InteractionCentricDashboard (10) - Interaction centric dashboards
- Card (11) - Card forms
- MainInteractiveExperience (12) - Main interactive experience forms
- ContextualDashboard (13) - Contextual dashboards
- Other (100) - Other form types
- MainBackup (101) - Main backup forms
- AppointmentBookBackup (102) - Appointment book backup forms
- PowerBIDashboard (103) - Power BI dashboard forms
Form Presentation Types:
- ClassicForm (0) - Classic form presentation
- AirForm (1) - Air form presentation
- ConvertedICForm (2) - Converted interaction centric form presentation
Creation Behavior:
- When creating without FormXmlContent, a minimal default form structure is generated
- New forms are active by default unless -IsActive:$false is specified
- Forms are created in unpublished state unless -Publish is specified
Update Behavior:
- Only specified properties are updated; unspecified properties remain unchanged
- Use -FormXmlContent to completely replace the form structure
- Publishing is optional but recommended for changes to take effect
Best Practices:
- Use specialized form cmdlets (Set-DataverseFormTab, Set-DataverseFormSection, Set-DataverseFormControl) for detailed form customization
- Always publish forms after making structural changes
- Test form changes in non-production environments first
- Back up existing forms before making major modifications