4

I'm posting this issue again as it is not resolved yet. I don't understand why it's not part of the known issues of Salesforce DX.

This has been reported here 5 months ago, with a temporary fix. The fix is unfortunately erased each time salesforce releases a new update of SFDX.

So, if you're wondering why sfdx force:data:tree:import triggers a MALFORMED_ID error, look at your field API name, including the namespace. It will fail if there is a number in the name. Example: "Tax1__c" or "namespace1_Tax__c".

As described in the link, here is the fix. Open the file dataImportApi.js that can be found here:

  • Mac Users: .local/share/sfdx/client/node_modules/salesforce-alm/dist/lib/data/dataImportApi.js
  • Windows: C:\Users\xxx\AppData\Local\sfdx\client\node_modules\force-language-services\node_modules\salesforce-alm\dist\lib\data\dataImportApi.js

You have to modify this regex expression:

const jsonRefRegex = /[.]*["|'][A-Z_]*["|'][ ]*:[ ]*["|']@([A-Z0-9_]*)["|'][.]*/igm;

to include the numbers expression:

const jsonRefRegex = /[.]*["|'][0-9A-Z_]*["|'][ ]*:[ ]*["|']@([A-Z0-9_]*)["|'][.]*/igm;

So, my question is more about how to make it part of the known issues so that it's part or their roadmap to fix it?

Thanks.

  • Still not resolved ... Everytime Salesforce update their sfdx package, my fix is gone. Please Salesforce do something, it's annoying !!!! – Lucas Ennouchi Feb 24 at 0:51

Your Answer

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

Browse other questions tagged or ask your own question.