1

I use git and sfdx with vs code. I have a scratch org where I made changes to the roles. I did sfdx pull source from scratch org. But I discarded the changes thinking I can pull them again from scratch org. But unfortunately everytime I do pull from scartch org I get "No results found". If I do sfdx force:source:status I get:

STATE                       FULL NAME                           TYPE         PROJECT PATH
──────────────────────────  ──────────────────────────────────  ───────────  ───────────────────────────────────────────────────────────────────────────────────────
Local Deleted               Global                              Role         force-app\main\default\roles\Global.role-meta.xml

I can Push in to scratch org because it says:

Error  force-app\main\default\roles\Global.role-meta.xml        
Your attempt to delete the role Global could not be completed because users are currently assigned to that role or at least one role reports to that role.

How can I undo this mess?

1

Before I suggest some steps word of caution

NOTE: Back up what's there in your local completely to your source control or to a zip file. Also back up your scratch org

Here are the steps I would take :

  • Back up all the metadata you have from the local by zipping the project folder
  • Back up everything from org by creating a new sfdx folder and authenticate through salesforce CLI and run sfdx force:mdapi:retrieve command. It will retrieve everything in your scratch org.
  • Delete all the files in the orgs folder. Read this blog to see what files are created in orgs folder.
  • Do a Source pull now to retrieve the changes from your org.
| improve this answer | |
  • thank you. but I found a simpler way to do it. Your method will work for huge changes. – nSv23 May 19 at 12:35
1

I found another way which was simpler for me. I had only few metadata changes therefore in my scratch org I just changed the names of the roles and rechanged them to the original names and I found that I am to pull.

| improve this answer | |
  • 1
    +1 Glad, you got it to work by a small workaround. – Mohith Shrivastava May 19 at 19:31

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.