• matt_b
  • NEWBIE
  • 30 Points
  • Member since 2010

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 1
    Replies

Hi all,

 

My code creates a custom object via the API, and then it updates the default layout via the API also. This has been working fine, but today I receive the error "Layout must contain an item for required layout field: Name". What is causing this error message?

 

My package.xml file:

<?xml version="1.0"?>

<Package xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://soap.sforce.com/2006/04/metadata">

 <types>

<members>My_Custom_Object__c-My Custom Object Layout</members>

<name>Layout</name>

 </types>

 <version>17.0</version>

</Package>

 

 

My My_Custom_Object__c-My Custom Object Layout.layout file:

<?xml version="1.0"?>

<Layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://soap.sforce.com/2006/04/metadata">

 <excludeButtons>Clone</excludeButtons>

 <excludeButtons>Share</excludeButtons>

 <excludeButtons>Submit</excludeButtons>

 <excludeButtons>Edit</excludeButtons>

 <excludeButtons>Delete</excludeButtons>

 <layoutSections>

<editHeading>true</editHeading>

<label>Information</label>

<layoutColumns>

 <layoutItems>

<behavior>Edit</behavior>

<field>Document_URL__c</field>

 </layoutItems>

 <layoutItems>

<behavior>Edit</behavior>

<field>Created__c</field>

 </layoutItems>

</layoutColumns>

<layoutColumns>

 <layoutItems>

<behavior>Edit</behavior>

<field>Lead__c</field>

 </layoutItems>

 <layoutItems>

<behavior>Edit</behavior>

<field>Account__c</field>

 </layoutItems>

 <layoutItems>

<behavior>Edit</behavior>

<field>Opportunity__c</field>

 </layoutItems>

</layoutColumns>

<style>TwoColumnsTopToBottom</style>

 </layoutSections>

 <layoutSections>

<editHeading>true</editHeading>

<label>System Information</label>

<style>TwoColumnsTopToBottom</style>

 </layoutSections>

 <layoutSections>

<customLabel>true</customLabel>

<editHeading>true</editHeading>

<label>Custom Links</label>

<style>CustomLinks</style>

 </layoutSections>

</Layout>

 

Can someone tell me why this has suddenly stopped working and what the "required layout field: Name" is?

  • February 23, 2010
  • Like
  • 0

Hi all,

 

I have created a custom object "Tickets" that has an Account lookup field in it, as well as a custom URL field that holds a unique URL pointing to a trouble ticket in our internal ticketing system. I have also created a custom list button that opens our ticketing system and initiates the "new ticket" process.

 

When I edit the Account layout to add the Tickets related list, only the Ticket ID (autonumber) field is displayed in the related list by default. I have to edit the related list, remove this field and add in the custom URL field and also add in my custom button.

 

My question is: can I modify the default related list for this new custom object, so that whenever a user adds the related list to their layout, they do not have to manually change the fields/buttons within it?

 

Thanks for any pointers

Matt 

  • February 19, 2010
  • Like
  • 0

Hi all,

 

I can successfully connect to the Metadata API and create a custom field, but what I would like to do is create three custom fields all at the same time. From reading the Metadata specifications it appears I can provide the .create() method with up to 10 metadata components, so technically I should be able to pass it an array of 3 custom fields instead of a single custom field, and it should process them all with only one .create() call.

 

My code to create one custom field is as follows:

 

SFMetadataWSDL.CustomField customField = new SFMetadataWSDL.CustomField();

 

customField.fullName = "Account.TestField__c";

customField.description = "This is a custom field created by the API";

customField.label = "Test Field;

customField.formula = "HYPERLINK(\"http://www.cnet.com\", \"Open Cnet\")";

customField.type = SFMetadataWSDL.FieldType.Text;

 

SFMetadataWSDL.AsyncResult asyncResult = sfMetadata.create(new SFMetadataWSDL.Metadata[] { customField })[0];

 

This works just fine, but if I modify it to pass the .create() method an array of 3 custom fields, I cannot compile.

 

SFMetadataWSDL.CustomField[] customField = new SFMetadataWSDL.CustomField[3];

 

customField[0].fullName = "Account.Testfield1__c";

customField[0].description = "This is a custom field number 1 created by the API";

customField[0].label = "Test Field 1";

customField[0].formula = "HYPERLINK(\"http://www.cnet.com\", \"Open Cnet\")";

customField[0].type = SFMetadataWSDL.FieldType.Text;

 

customField[1].fullName = "Account.Testfield2__c";

customField[1].description = "This is a custom field number 2 created by the API";

customField[1].label = "Test Field 2";

customField[1].formula = "HYPERLINK(\"http://www.cnet.com\", \"Open Cnet\")";

customField[1].type = SFMetadataWSDL.FieldType.Text;

 

customField[2].fullName = "Account.Testfield3__c";

customField[2].description = "This is a custom field number 3 created by the API";

customField[2].label = "Test Field 3";

customField[2].formula = "HYPERLINK(\"http://www.cnet.com\", \"Open Cnet\")";

customField[2].type = SFMetadataWSDL.FieldType.Text;

 

SFMetadataWSDL.AsyncResult[] asyncResult = sfMetadata.create(new SFMetadataWSDL.Metadata[] { customField });

 

The compilation error I receive is "Cannot implicitly convert type 'SFMetadataWSDL.CustomField[]' to 'SFMetadataWSDL.Metadata'". I think I'm being an idiot here and have just missed something out - can someone point it out?

 

Thanks

Matt 

  • January 20, 2010
  • Like
  • 0

Hi all,

 

Our company has written a .NET web-based billing system which is in use by a number of other companies (including ourselves). A large number of the companies also use Salesforce, and so it would make sense to integrate the two so that:

 

a) Users can click a link against an account in SF that will start the "new customer" process in the billing system, and the name & address fields will be pre-populated with the data from SF.

 

b) When the account has been created in our billing system, the SF account will be updated so that the link to "create new customer in billing system" changes to "view customer in billing system", to enable SF users to quickly locate the account in our

 

I started to plan the project on paper, and was planning to use the API to create the custom hyperlink fields in SF, and also to get the name and address fields out of SF for the new account. This all looked straightforward, but it has come to my attention that some of our billing system users are using the SF Group or Professional edition, which does not have API access.

 

How else can this simple process be achieved, without using the Salesforce API?

 

Any ideas to push me in the right direction would be appreciated!

 

Thanks

Matt 

  • January 08, 2010
  • Like
  • 0

Hi all,

 

My code creates a custom object via the API, and then it updates the default layout via the API also. This has been working fine, but today I receive the error "Layout must contain an item for required layout field: Name". What is causing this error message?

 

My package.xml file:

<?xml version="1.0"?>

<Package xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://soap.sforce.com/2006/04/metadata">

 <types>

<members>My_Custom_Object__c-My Custom Object Layout</members>

<name>Layout</name>

 </types>

 <version>17.0</version>

</Package>

 

 

My My_Custom_Object__c-My Custom Object Layout.layout file:

<?xml version="1.0"?>

<Layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://soap.sforce.com/2006/04/metadata">

 <excludeButtons>Clone</excludeButtons>

 <excludeButtons>Share</excludeButtons>

 <excludeButtons>Submit</excludeButtons>

 <excludeButtons>Edit</excludeButtons>

 <excludeButtons>Delete</excludeButtons>

 <layoutSections>

<editHeading>true</editHeading>

<label>Information</label>

<layoutColumns>

 <layoutItems>

<behavior>Edit</behavior>

<field>Document_URL__c</field>

 </layoutItems>

 <layoutItems>

<behavior>Edit</behavior>

<field>Created__c</field>

 </layoutItems>

</layoutColumns>

<layoutColumns>

 <layoutItems>

<behavior>Edit</behavior>

<field>Lead__c</field>

 </layoutItems>

 <layoutItems>

<behavior>Edit</behavior>

<field>Account__c</field>

 </layoutItems>

 <layoutItems>

<behavior>Edit</behavior>

<field>Opportunity__c</field>

 </layoutItems>

</layoutColumns>

<style>TwoColumnsTopToBottom</style>

 </layoutSections>

 <layoutSections>

<editHeading>true</editHeading>

<label>System Information</label>

<style>TwoColumnsTopToBottom</style>

 </layoutSections>

 <layoutSections>

<customLabel>true</customLabel>

<editHeading>true</editHeading>

<label>Custom Links</label>

<style>CustomLinks</style>

 </layoutSections>

</Layout>

 

Can someone tell me why this has suddenly stopped working and what the "required layout field: Name" is?

  • February 23, 2010
  • Like
  • 0