Power Apps - Upgrade custom form
- Create a root folder for the upgrade / sync of a SharePoint Power Apps Custom Form
- Export and unpack the DEV package of the custom form
List > List Settings > Form Settings > Use a custom form created in Power Apps > See versions and usage > Export PackageName: DEV > ExportDownload and move to orginalpackages folder, unzip to .\DEV - Export the PRD package of the custom form
List > List Settings > Form Settings > Use a custom form created in Power Apps > See versions and usage > Export PackageName: PRD > ExportDownload and move to orginalpackages folder, unzip to .\PRD - Unpack development App and production App
CD <root folder for the upgrade>Get-ChildItem .\dev\*.msapp -Recurse | ForEach-Object {pac canvas unpack --msapp $_ --sources .\devmsapp}Get-ChildItem .\prd\*.msapp -Recurse | ForEach-Object {pac canvas unpack --msapp $_ --sources .\prdmsapp} - Copy DEV yaml over the PRD yaml and package
copy ".\devmsapp\Src\FormScreen1.fx.yaml" ".\prdmsapp\Src"Find replace connection reference inFormScreen1.fx.yamlGet-ChildItem .\prd\*.msapp -Recurse | ForEach-Object {pac canvas pack --sources .\prdmsapp --msapp $_} CD <root folder for the upgrade>\PRD[CTRL]+ACompress to zip file (.\prd\manifest.zip)- Remove PRD custom form
List > List Settings > Form Settings > Use the default SharePoint formList > List Settings > Form Settings > Delete custom form > OK - Import PRD package
Power Apps Maker > Apps > Import Canvas App > .\prd\manifest.zipAction > Create as New > Save - Update custom form and publish
List > List Settings > Form Settings > Use a custom form created in Power Apps > Modify Form in Power Appsremove datasource and add datasource > Save > Publish
Gescript:
<#
This script assumes 2 exported canvas zip files downloaded from a dev library (DEV.zip) and from it's prd library (PRD.zip)
Running this script it will
- extract these zipped files
- unpack the canvas app in the files
- overwrite the PRD FormScreen1.fx.yaml file with the one of the DEV
- pack the PRD canvas app
- zip the PRD solution to PRD_Deploy.zip
Standard Operational Procedure
1. DEV List > List Settings > Form Settings > See versions and usage > Export package > Name: DEV > Export
2. Copy generated DEV_99999999.zip to this folder and rename to DEV.zip
3. PRD List > List Settings > Form Settings > See versions and usage > Export package > Name: PRD > Export
4. Copy generated PRD_99999999.zip to this folder and rename to PRD.zip
5. Run this script
#>
Expand-Archive .\DEV.zip -DestinationPath dev
Expand-Archive .\prd.zip -DestinationPath prd
Get-ChildItem .\dev\*.msapp -Recurse | ForEach-Object {pac canvas unpack --msapp $_ --sources .\devmsapp}
Get-ChildItem .\prd\*.msapp -Recurse | ForEach-Object {pac canvas unpack --msapp $_ --sources .\prdmsapp}
Copy-Item ".\devmsapp\Src\FormScreen1.fx.yaml" ".\prdmsapp\Src"
Get-ChildItem .\prd\*.msapp -Recurse | ForEach-Object {pac canvas pack --sources .\prdmsapp --msapp $_}
Compress-Archive .\prd\* -DestinationPath PRD_Deploy.zip
Remove-Item -LiteralPath "dev" -Force -Recurse
Remove-Item -LiteralPath "devmsapp" -Force -Recurse
Remove-Item -LiteralPath "prd" -Force -Recurse
Remove-Item -LiteralPath "prdmsapp" -Force -Recurse
<#
6. PRD List > List Settings > Form Settings > Use the default SharePoint form > Delete custom form
7. make.powerapps.com > Apps > Import canvas app > Choose package file to import: PRD_Deploy.zip
8. Import setup: Create as new > Import
9. PRD List > List Settings > Form Settings > Modify custom form > Update reference names (only if DEV and PRD have different names) > Save > Publish
Form is deployed / copied to production list
#>