forcedotcom / devops-center-feedback

61 stars 2 forks source link

cannot delete profile in use (only if deleting the custom field) #207

Open gtweed12 opened 1 year ago

gtweed12 commented 1 year ago

Describe the bug I have deleted only the custom field When I pulled the changes the profiles are marked as delete(but in the org that I have deleted the profiles are not deleted) The pull changes just brought the profiles as deleted.

When I include all the changes in the Work item , the promotion failed due to following error

Profiles cannot be deleted as they are in use(DONOT kNOW WHY the PROFILES ARE DELETED)

To Reproduce Steps to reproduce the behavior:

  1. delete the custom field
  2. pull the changes
  3. include all the changes in the Work item (that includes profile)
  4. promote the work item ...

Expected behavior Should delete only the field and change the profiles

Screenshots Profiles cannot be deleted as they are in use

Additional context Add any other context about the problem here.

kylewalke commented 1 year ago

Hi @gtweed12 , I think I can help resolve some of the confusion here. Profiles are very tough to work with. This is in part because some of the optimizations around them included only pulling the 'relevant' parts of the Profile when the metadata API queries them. This means if you have a remove of a custom field on a custom object then this appears to the metadata api as if you've removed a section from the Profile (which is why this appears as remove in the changes tab). However, since we are only removing this field and the rest of the custom objects aren't selected, it may be a bug that we see that the entire profile is being removed. Unfortunately this is not within our team's ability to change (in regards to how Profiles are pulled in the metadata api) so until then the best we can currently do is add profiles to the .forceIgnore file, or to pull the entire profile and all objects each time any change is made to any object. We understand this isn't ideal and are working on a better solution as we speak.