I am still fairly new to SaleforceDX. I have been tasked with putting together a sample data plan matching a small portion of our production data, for our new Scratch-Orgs. With foreign-key type relationships, I am having no problems whatsoever (Using the '@' symbol to build references like @AccountRef1). However, I am failing to see how this would be done when there isn't such a foreign-key type of field (master-detail and __r relationships specifically.) I have read a bit about putting together embedded queries, but that seems like it could get ugly, and I don't completely understand it. My question is: how do I import related objects without a field to put the @ related object reference into?

For example: A relates to B. How do I specify a relationship like B.ClassOfA.Id='@RefId' in my Plan's JSON file for B.

  • 2
    You shouldn't do this manually - you use the force:data:tree:export command with the -p flag to generate the plan file with your json data files. Can you specify the relationship query you're using to extract the data? Commented Aug 18, 2019 at 23:48
  • @ThomasTaylor I'm not using a relationship query. I am just independently querying A and B, and then trying to tie-in the relationship after the fact. I have tried using the -p command, but all I get back is the same records as doing it without the -p, plus a series of errors like 'ERROR: Reference Group not found for OwnerId. Skipping record a0p0W000009fZZFQA2.'
    – Mr. B
    Commented Aug 19, 2019 at 14:57
  • @ThomasTaylor Please provide an example of how to query across relationships (if you can), so I can upvote you and make your answer the accepted one. Much appreciated.
    – Mr. B
    Commented Aug 19, 2019 at 14:59

1 Answer 1


Turns out this is not possible yet, but may be in the future. The following YouTube video explains the plans for a Shape Pilot currently in the making:


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .