For quite some time, Salesforce didn’t have an efficient way to allow its users to deploy metadata to different orgs. Yes, we have Change Sets but we have had them now for a long time and things haven’t changed a lot for Change Sets (no pun intended). They do the work but there is a lot of room for improvement. We do have alternative solutions like Gear Set but that’s a third-party app and is paid. So, it was about time that Salesforce rolled out its own new deployment solution – DevOps Center. But boy does it lack some features! In the new DevOps Center, at the moment of this writing, there are a lot of bugs and missing features. For example, you can’t even delete a project in DevOps Center.
You heard that right. One may think that deletion is part of the basic CRUD and should be possible in something like DevOps Center but it isn’t. Salesforce’s own Technical writer suggests the following:
“There’s no current way to delete a project from you can rename it so it goes to the bottom of the list (through the Settings page). For example: zMyProject. We’re looking at ways to remove projects from the list.”
However, there is in fact a way through which you can delete a project in the DevOps Center of Salesforce. Let me guide you. Before that, it should be noted that the following solution is just a workaround, and perhaps in the future Salesforce will add the Project deletion feature so the following method won’t be required. If there comes that day, I will be sure to update this guide.
That said, let’s jump right into the solution.
Deleting a Project in DevOps Center
In order to remove a Project in DevOps Center, you have to know about the objects that belong to the DevOps Center app. A few of those are:
The whole idea is to start with the basic step which is to try to delete the Project from Developer Console by querying the object via Query Editor and then running into errors. You read right. We would have the error that you can’t delete the Project record from the backend because it is being referenced in Pipeline Object records. We would use this error to get the Pipeline ID and will try to delete it and will again run into an error that will say that the Pipeline record has dependencies on the X, Y, and Z objects. And we will keep on going backward while trying to delete the records.
Ultimately, we would reach to a point (In my case it was at the Back Sync object) where the records would start to delete. From that point onwards, keep coming back while removing all the dependencies in various objects of the DevOps Center.
Finally, the project record would have no reference anywhere and can be deleted from Query Editor or Anonymous Code Window.
In my particular scenario, I had to do the deletions in the following order.
- Back Sync
- Remote Change
- Change Submission
Note that I only deleted those records that were specifically mentioned in the Error Message provided by Salesforce. These associations depend on your usage of DevOps Center and you might need to delete either more or fewer dependent records. And finally, the project will be deleted from the backend and the front end.
If the project is still visible on the front end, go to the Project object list view from the front end and delete it manually from there. This will only be possible if you first remove all the dependencies by the hacky method suggested above.
At the moment of writing, Salesforce DevOps Center has no standard option to delete the Project. In order to delete a Project, you will need to use Developer Console and remove all the dependencies of the DevOps center project in other objects like Pipeline, Change Submission, etc. While removing the dependency, you will run into further dependencies. You will have to remove those as well. Once all references are removed, the Project record will be able to delete from both the back-end and front-end – via Project object List View.
I know this method doesn’t fall into good practices but it works while the standard way doesn’t. Wait, there is not even a standard way to delete a project in DevOps Center (winks).
- How to find Salesforce org type via Apex code?
- How to generate Excel file in Aura Component of Salesforce