The Package Deployer is a great way to move solutions between environments consistently while enabling you to do things like custom tasks and migrating data at the same time.
I hadn’t looked into the data facilities of the Package Deployer but had a project where we were doing more and more manual data imports (small files) so decided to take the leap and see how it works.
There is some good and some bad.
<configimportfile filename="dataTypes.csv" filetype="CSV" importtoentity="cms_datatype" datadelimiter="" fielddelimiter="comma" enableduplicatedetection="true" isfirstrowheader="true" isrecordownerateam="false" owneruser="" waitforimporttocomplete="true" />
The configuration is pretty simple, but there are a few things to be aware of.
A small issue I ran into right off the bat, was an entity that used the same display name for two fields. It’s an error with the entity, but one reason why I think using the schema names would be much better as they are less prone to errors. If you are seeing data records going into the system as successful but no values, check your fields, this is most likely the case.
Re-running the same file
If you have a file that you are continuing adding records to (makes sense) and you try to run the deployer again, it will ignore the file. Unless you change the filename will it get picked up.
This is because the system detects an already executed line in the Imports view and thus does not want to import records twice.
In my searching the only thing I have found is to rename the files to get this to work, otherwise, go into the Import jobs and clear it out. If you want to do this automatically, you’ll need to write a custom task to wipe out this information ahead of time.
When you enable “enableduplicatedetection” to true, you are telling the package deployer to respect the previously configured duplicate data detection rules. When this is set to false, you are telling the deployer to ignore them.
Even if you set “Enable duplicate detection” for “During data import” to true, this field in the config will override that setting.
This doesn’t make sense to me, but there it is, the more you know.
Additional Code Tasks
I hadn’t planned into building code tasks on this particular project so early in the project, but it looks like I’m going to be deploying some duplicate data rules that need to be created before the data import so I can close the circle on this work.