Home General

How to add a custom field to a layout section in SalesForce via the API

Rohit bhatRohit bhat Machine Learning Trainer

I am creating a Java API integration tool, that on start-up will create a new custom filed if it doesn't exist for Lead & Contact. After a bit of searching, I have found how to do this. Now the next bit on the list is to get the newly created field into the "Lead Information" or "Contact Information" layout.

I took help from a person who did salesforce training and also looked into metadata API docs and cannot find an example, either using Java or plain SOAP messages. I have searched online, in most of the forums, and sample codebases I can find, with no success.

So if anyone is able to supply an example either through Java or SOAP, that would be fantastic.

Comments

  • rappardrappard Martin van Rappard EM
    edited February 14

    Hi @Rohit bhat,

    Erm ... not to be rude, but how is this related to any of the products OpenText offers? Wouldn't it be better to post in a Salesforce(-related) forum?

    Martin van Rappard
    Technical Support Engineer III
    OpenText

  • You can't just add a field to a layout. You have to first get the existing layout and then add the field to it and then update the layout. A layout is a complex object made up of other objects representing the sections and then the rows, etc. I recommend first retrieving a layout via either the SOAP or Metadata API and once you've looked at the result, it should be clearer on how you can parse it and inject your additional row and field.
  • Yes there doesn't seem to be related to the OpenText offers. mycfavisit walmartone 
  • You can't just add a field to a layout. You have to first get the existing layout and then add the field to it and then update the layout. A layout is a complex object made up of other objects representing the sections and then the rows, etc. I recommend first retrieving a layout via either the SOAP or Metadata API and once you've looked at the result, it should be clearer on how you can parse it and inject your additional row and field.
This discussion has been closed.