forcedotcom / cli

Salesforce CLI
https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/
BSD 3-Clause "New" or "Revised" License
494 stars 78 forks source link

Deleted custom field doesn't show in source tracking #1622

Closed mdavidsonST closed 1 year ago

mdavidsonST commented 2 years ago

Summary

We have a sandbox with change tracking enabled and after I delete a custom field the change doesn't show in source change tracking data. Results also show Layouts being deleted when they should only be modified.

Steps To Reproduce:

Sandbox link: https://wmw--1wf.sandbox.my.salesforce.com/

  1. Delete a custom field on standard or custom object.
  2. run sfdx force:source:status -u 1wfSandboxOrg

Expected result

Results should include Remote Deleted custom field name

Actual result

Results include profile, record types, and layouts impacted, but not the actual custom field.

System Information

image

github-actions[bot] commented 2 years ago

Thank you for filing this issue. We appreciate your feedback and will review the issue as soon as possible. Remember, however, that GitHub isn't a mechanism for receiving support under any agreement or SLA. If you require immediate assistance, contact Salesforce Customer Support.

mshanemc commented 2 years ago

can you run this against your sandbox

sfdx force:data:soql:query --t -q "SELECT MemberType, MemberName, IsNameObsolete, RevisionCounter FROM SourceMember WHERE RevisionCounter"

If you can see an entry in the SourceMember table, then the server is fine and there's a bug is on the CLI (and we'll get it fixed for you). IsNameObsolete should be true for the deleted field. If your sandbox has crazy number of entries in that table, you can filter by MemberType or MemberName or IsNameObsolete

If you don't see an entry, then we'll have to get the people who own custom fields to fix it and that'll take a while longer.

mdavidsonST commented 2 years ago

I don't see it in the list.

image

mshanemc commented 2 years ago

was it on the Standard Contact object?

mdavidsonST commented 2 years ago

Yes, Standard Contact object. We're using Salesforce Platform with a managed package, but the field being deleted was not from the managed package. I also tried deleting a field from a custom object with same results.

mdavidsonST commented 2 years ago

Is there somewhere else I should create a ticket?

mshanemc commented 2 years ago

yeah, normal salesforce support case. You can include a link to this issue when you give all the info about it.

github-actions[bot] commented 2 years ago

We have determined that the issue you reported exists in code owned by another team that uses only the official support channels. To ensure that your issue is addressed, open an official Salesforce customer support ticket with a link to this issue. We encourage anyone experiencing this issue to do the same to increase the priority. We will keep this issue open for the community to collaborate on.

mdavidsonST commented 2 years ago

I received an update for my support ticket.

We checked the setup audit trail and we found that it is capture on their but not in SFDX. Since SFDX is handled by our developer team we will be transferring this case to our developer team so that they can assist you better.

mdavidsonST commented 2 years ago

Well now Salesforce support is saying that "There is no help article from salesforce confirming that this object (sourcemember) will track the deleted fields."

Can anyone confirm whether source tracking and sfdx force:source:status should track deleted fields? If so can you point me to documentation that I can share with support? What's weird is I do have one sandbox where one of the deleted fields shows up in source tracking, but the other fields I deleted don't.

mshanemc commented 2 years ago

What's weird is I do have one sandbox where one of the deleted fields shows up in source tracking, but the other fields I deleted don't.

That is weird.

They definitely show up in scratch orgs. I think we've seen other sandbox tracking issues where if you make the field then delete, they'd be in the tracking but it wasn't happening for fields that got created as part of the sandbox replication (that is, the field is a custom field in your prod org) and you're trying to delete it.

Sandbox tracking has always been just a bit different in unexpected ways. If your case ends up with a dead end, I can still log one but I expect it to not get much attention without something from customers.

mdavidsonST commented 2 years ago

I may give up on this as I don't think source tracking is there yet. Luckily all the page layout changes get captured so I can promote the pieces the users see and then go back and manually delete the fields again or figure out how to build a destructive changes file from scratch.

I've also found weird behaviors if a field is created and then renamed in the sandbox. Unless I get clarity from someone who actually knows what source tracking should and shouldn't be able to handle we'll just try to avoid edge cases.

mshanemc commented 2 years ago

a lot of people missed this, but there is a force:source:manifest:create that will spit out a package.xml based on either filepaths or metadata types (so it's the same as -m and -p from source:deploy)

and of course force:source:delete will delete stuff without messing with manifests.

mdavidsonST commented 2 years ago

I just got a call with Salesforce and they said that source tracking and sfdx do not track deletions. I've asked them to update the documentation to clarify that. I'll also be asking the devops center folks to clarify in their documentation what they mean when they say that it handles deleted metadata.

RupertBarrow commented 1 year ago

Hi @mshanemc, can you confirl the status of this issue and the explanations given ? Does Source Tracking track deletions, even in sandbox and even of fields (eg) created in prod then deleted in sandbox ?

mshanemc commented 1 year ago

duplicate of https://github.com/forcedotcom/cli/issues/1093

The underlying issue a source tracking bug on sandboxes.

amtrack commented 5 months ago

@mshanemc Is there an update or Known Issue for it?

I rarely work with Sandboxes and when this was reported to me I was surprised.

From what I can see, this is how Source Tracking works in Sandboxes:

mshanemc commented 5 months ago

I'll talk to them about it doing something.

My understanding is that deletions are tracked EXCEPT where they were created as part of the sbox copy (ie, the field exists in the org the sandbox was created from). There's no good reason for that to be the case.

mshanemc commented 3 months ago

there's a KI now. @amtrack @RupertBarrow https://issues.salesforce.com/issue/a028c00000zIbnE/source-tracking-doesnt-track-members-that-were-created-before-the-framework-being-enabled

mshanemc commented 3 months ago

duplicate of https://github.com/forcedotcom/cli/issues/1093