I was wondering if we can check if a field is already added to layout, add it otherwise. As I used the metadata API for layouts, noticed that if we include a single component in Metadata.DeployContainer (which is existing in current layout), whole deployment fails.

It's great to,

  1. Have ability Check the component/field existence before adding to container
  2. Pass a parameter to ignore failed ones
  3. Have reasons to know why it fails in the callback response

Is it possible using the Apex Metadata API?

1 Answer 1


There is no such Boolean parameter available in Apex Metadata API. But we have this in Tooling API. In Force.com Tooling API we have a Boolean parameter IsCheckOnly which Indicates whether the asynchronous request compiles the code without making any changes to the organization (true) or compiles and saves the code (false). Please check this https://developer.salesforce.com/docs/atlas.en-us.api_tooling.meta/api_tooling/tooling_api_objects_containerasyncrequest.htm

  • 1
    There is a checkonly option for the metadata API, too.
    – sfdcfox
    Jul 14, 2017 at 12:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .