We have renamed certain fields on a working scratch org, and we expected the renaming to work correctly.

However, when we perform

sfdx force:source:pull

the changes in

  • validation rules
  • flows
  • permission sets
  • profiles

are not pulled. As a result we had to engage in a very long string replace in all files we have in our project. Is there anything that can be done to "invalidate" local copies so that sfdx can pull them ?

  • By any chance they are added in .forceignore file? – Raul May 23 '19 at 6:50
  • No no they are there, it seems like sfdx doesn't recognize that the validation rule and other customizations have changed on the org? – Edmondo1984 May 23 '19 at 6:53
  • Translations are not coming as well – kurunve May 23 '19 at 7:00
  • did you try running force:source:status command to check what is added/deleted on local and remote? This should give you some idea. – Ashish Sharma May 23 '19 at 7:42

When sfdx gets refuses to push or pull something that I know to have changed, I try deleting the .sfdx directory in my local project directory. This contains sfdx's information on who has the latest copy of what. Once you've done that, you can do a push/pull with the --forceoverwrite flag.

Obviously, you need to be careful with this as it might lead to squashing changes that you really wanted to preserve. But, if the only difference between local and scratch org is some thing that sfdx is refusing to acknowledge, then this can help.

NB Don't delete .sfdx in your home directory, or you'll lose all your local information about which orgs you're connected to and it takes a while to recover. I've done this accidentally once, and it's a great way to waste a lot of time!

| improve this answer | |
  • I tried, but this is slow: every time I need to change a field name which is included in validation rules it would trigger this problem. I use find/replace in visual studio code and push, but this is a little bit of a pain – Edmondo1984 May 23 '19 at 13:04
  • It really sounds like a bug/limitation in sfdx, and I'd only consider my answer to be a workaround. Have you posted it on the trailblazer community for 2GP? success.salesforce.com/_ui/core/chatter/groups/… – Aidan May 23 '19 at 14:27

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.