3

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 ?

4
  • By any chance they are added in .forceignore file?
    – Raul
    Commented May 23, 2019 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?
    – Edmondo
    Commented May 23, 2019 at 6:53
  • Translations are not coming as well
    – kurunve
    Commented May 23, 2019 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. Commented May 23, 2019 at 7:42

1 Answer 1

2

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!

2
  • 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
    – Edmondo
    Commented May 23, 2019 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
    Commented May 23, 2019 at 14:27

You must log in to answer this question.

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