I am looking for a way to prepopulate my scratch org with some sample data. As part of this sample data, I need to also create few content version records(images).

But the sfdx force:data:tree:export command returns version data as a link.

I also tried to store serialized version of contentversion records and insert them on new scratch org creation but it fails because of inconsistency in how apex serializes and deserializes base64 data.

Is there a recommended approach to handle this?


Salesforce CLI has limited support for the file unless you use a custom script it.

Looks like community has a solution,

Install the shane-sfdx-plugins using sfdx plugins:install shane-sfdx-plugins

Once installed I would explore the below commands

sfdx shane:data:file:download -i <filed>

And upload using

sfdx shane:data:file:upload -f <filepath> -p <parentId>

You can explore Shane's amazing work here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.