Skip to main content
All CollectionsTroubleshootingSalesforce validation errors
Resolving validation errors - "Cannot use field:WhatId in RelatedContent section." on Layout metadata type
Resolving validation errors - "Cannot use field:WhatId in RelatedContent section." on Layout metadata type

Cause and solution to this Salesforce validation error

Mateusz Kochanowicz avatar
Written by Mateusz Kochanowicz
Updated over 3 months ago

Explanation of the error

You may come across this Salesforce validation error when deploying Layout metadata to your target org, or when promoting changes via PR in Pipelines:
​​"Cannot use field:WhatId in RelatedContent section."
​
An example of the error may look like this:

Salesforce documentation explains that this specific validation/deployment error on the Layout metadata happens "when orgs have either Health Cloud or Financial Services Lending, or Financial Services Insurance add-on enabled".

Resolution

The workaround proposed by Salesforce is to remove the WhatId section from relatedcontentItem.


Deleting this part of XML from the affected Layout metadata should allow you to deploy or promote changes successfully.


An example of how the XML looks within Gearset's comparison results preview:

This resolution has worked for other Gearset users.

However, if it doesn't work or apply to your specific use case, do let us know in the in-app chat and we'll be happy to help.

Disclaimer: This error is returned directly by Salesforce, rather than Gearset. Even so, we offer guidance based on our combined experience with the Metadata API. Where possible, we try to help guide you to fix or avoid this error. In the case that this isn't possible, we may need to direct you to Salesforce support for further clarification.

Did this answer your question?