3

I'm having some trouble with importing Json file which containing data in SObject using

sfdx force:data:tree:import -p ./data/Project__c-Round__c-plan.json

It spits out an error which is:

ERROR running force:data:tree:import: The requested resource does not exist

I have double checked the path and also existence of the json itself in folder data.

this is the Project__c-Round__c-plan.json

    [
        {
            "sobject": "Project__c",
            "saveRefs": true,
            "resolveRefs": false,
            "files": [
                "Project__cs.json"
            ]
        },
        {
            "sobject": "Round__c",
            "saveRefs": false,
            "resolveRefs": true,
            "files": [
                "Round__cs.json"
            ]
        }
    ]
1
  • did you get any solution for this issue? – Sanjay Kharwar Oct 20 '20 at 14:36
0

Root Cause: In my case, When I created data JSON file, My dev Hub was not configured with any namespace but after namespace configuration, I got this issue.

Solution: Change data JSON files and add your namespace with every file and fields.

Old Name: FileName.json and fields in the file was fieldName

New Name: NameSpace__ FileName.json, NameSpace__ fieldName

Before: (File Name: ABC.json)

{
"records": [
    {
        "attributes": {
            "type": "ABC__c",
            "referenceId": "ABC__cRef1"
        },
        "Name": "Main ABC",
        "IsActive__c": true,
        "Label__c": "Main Process",
        "MNO__c": "@MNO__cRef1",
        "Order__c": 1
    }
]

}

After: (File Name: NAMESPACE__ABC.json)

{
"records": [
    {
        "attributes": {
            "type": "NAMESPACE__ABC__c",
            "referenceId": "NAMESPACE__ABC__cRef1"
        },
        "Name": "Main ABC",
        "NAMESPACE__IsActive__c": true,
        "NAMESPACE__Label__c": "Main Process",
        "NAMESPACE__MNO__c": "@NAMESPACE__MNO__cRef1",
        "NAMESPACE__Order__c": 1
    }
]

}

==========================================

I also got the same issue. I have reinstalled the latest version but did not get luck. When I used --json then I got the following error message.

{
"status": 1,
"name": "NOT_FOUND",
"message": "The requested resource does not exist",
"exitCode": 1,
"commandName": "DataTreeImportCommand",
"stack": "NOT_FOUND: The requested resource does not exist\n    
at HttpApi.getError (/usr/local/lib/sfdx/node_modules/jsforce/lib/http-api.js:250:13)\n    
at /usr/local/lib/sfdx/node_modules/jsforce/lib/http-api.js:95:22\n    
at tryCallOne (/usr/local/lib/sfdx/node_modules/promise/lib/core.js:37:12)\n    
at /usr/local/lib/sfdx/node_modules/promise/lib/core.js:123:15\n    
at flush (/usr/local/lib/sfdx/node_modules/asap/raw.js:50:29)\n    
at process._tickCallback (internal/process/next_tick.js:61:11)\nOuter stack:\n    
at Function.wrap (/usr/local/lib/sfdx/node_modules/@salesforce/core/lib/sfdxError.js:151:27)\n    
at DataTreeImportCommand.catch (/usr/local/lib/sfdx/node_modules/salesforce-alm/dist/ToolbeltCommand.js:216:46)\n    
at process._tickCallback (internal/process/next_tick.js:68:7)",

"warnings": [] }

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.