Overview
The North52 BPA Data Packager functionality allows you to easily move data stored in records from one Dynamics 365 CE/Dataverse instance to another. This is a common scenario when deploying configuration data such as Subjects in the subject tree.
In this article we describe how you build a Data Package which you can use to deploy Subjects from one instance to another. You can easily add further configuration data such as Business Units and Teams to a Data Package, however in this article we are going to focus only on Subjects.
Data Package Setup
Data Setup
For this tutorial we need to create a few Subject records:
- Navigate to your environment
- In the right hand top corner, click on the cog wheel and select Advanced settings
- Click Settings > Business > Business Management > Subjects
- Click Add a Subject
- Enter Data Packager as the Title
- Click Add
- Add further Subjects so you have a Subject tree like:
- Data Packager
- Adding Records
- Executing a Data Package
- DevOps
- Manually
- Replacing GUIDs
- Data Packager
Create Solution
Before we create a Data Package, the best practice is to create a Dynamics 365 Solution which will hold the Data Package records.
- Go to https://make.powerapps.com/
- Ensure you are in the correct environment
- Click on Solutions in the sidebar
- Click the New button
- Enter Subject Tree Data Package for the Display Name
- Select a Publisher
- Enter 1.0.0.0 in the Version field
- Click Save and Close
Create the Data Package
- Navigate to the North52 App and select Data Packager > Data Packages
- Click the New button
- Set the Name to Subject Tree - Data Package
- Expand Deployment Settings
- Select Subject Tree Data Package as the Deployment Solution
- Click Save
Add data to the Data Package
- Select the Explore tab
- Select Subject from the drop down list
- The Subject records will be listed
- Expand the Data Packager node by clicking on the triangle icon
- Wait for the related node data to load
- Expand the Related (1:N) node
- Expand the subject : parentsubject node
- Expand the Executing a Data Packager node by clicking on the triangle icon
- Wait for the related node data to load
- Expand the Related (1:N) node
- Expand the subject : parentsubject node
- We now have the Subject hierarchy shown for the Data Packager subject
- Check the checkbox for the records in this hierarchy (indicated by the record icon):
- Click the lightning bolt icon to add the selected records to the Data Package
- Two Data Package sheets are added:
- Subject - this sheet will create records when the Data Package is executed
- Subject-SR-Update - this sheet updates Self-Reference fields i.e. the Parent Subject
- Two Data Package sheets are added:
- Select the Subject sheet
- Click Save
Note: For this tutorial we are showing you how to use the related entities tree view to select related records. As all the records were available in the top level nodes we could have manually selected them from there.
Export Data Package
The Data Package is now ready to be exported for use in a target instance.
- Go to https://make.powerapps.com/
- Ensure you are in the correct environment
- Click on Solutions in the sidebar
- Select or open the Subject Tree Data Package solution containing your Data Package records
- Click the Export button to export the solution (you can use either unmanaged or managed solutions to export Data Packages)
- Once exported the Data Package is ready to be imported into another instance
Testing
Option 1: Multi-instance test
If you have another instance available, import the Data Package on the second instance, otherwise follow the alternative instructions below:
- Go to https://make.powerapps.com/
- Ensure you are in the correct environment
- Click on Solutions in the sidebar
- Click the Import button
- Locate your Subject Tree Data Package solution file and complete the import wizard
- Once the import is complete, click the Publish All Customizations button
- This will trigger the N52 Publish All workflow to 'unpack' the Data Package
- Wait for this workflow to complete (you can monitor it from System jobs)
- Navigate to the North52 App and select Data Packager > Data Packages
- Open the Subject Tree - Data Package record
- Click the lightning bolt button in the top right of the editor canvas
- Click the Execute button
- Once it is completed and there were no errors, go to Advanced Settings > Business > Business Management > Subjects
- You should see your new subject hierarchy in the Subject tree
Option 2: Single-instance test
If you don't have another instance available, we can execute the package on the same instance to create duplicate records, however before we do this we need to make some changes to make the records unique:
- Select the Subject sheet
- Ensuring that no GUIDs are highlighted, from the editor navigation bar select Commands > Guid Switcher
- This will replace all GUIDs with new ones so that when the Data Package executes new records are created
- Not that the reference to the Parent Subject field on the Subject-SR-Update sheet is dynamic (i.e. it references record rows in the Subject sheet) so the changes to GUIDs will not affect these updates
- So that we can differentiate our new records edit all the Titles of the Subject records, e.g. add a 2 to the end of each Title
- Ensure that each Title is encapsulated by single quotes in the cell
- Before
- After
- Click Save
- Click the lightning bolt button in the top right of the editor canvas
- Click the Execute button
- Once it is completed and there were no errors, go to Advanced Settings > Business > Business Management > Subjects
- You should see your new subject hierarchy in the Subject tree: