• Ashritha S
  • NEWBIE
  • 0 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 4
    Replies
I got a exception ' System.CalloutException: Web service callout failed: Unable to parse callout response. Apex type not found for element displayLocationInDecimal '  while reading a geolocation custom field using metadata api.
Hi ,

I tried creating page layout using metadata api using the code
  MetadataService.MetadataPort service = new MetadataService.MetadataPort();  
  service.SessionHeader = new MetadataService.SessionHeader_element();
  service.SessionHeader.sessionId = UserInfo.getSessionId();

    MetadataService.Layout layout = new MetadataService.Layout();
    layout.fullName = 'Case-My Layout';
    layout.layoutSections = new List<MetadataService.LayoutSection>();
    MetadataService.LayoutSection layoutSection = new MetadataService.LayoutSection();
    layoutSection.editHeading = true;
    layoutSection.label = 'Description Information';
    layoutSection.style = 'TwoColumnsTopToBottom';
    layoutSection.layoutColumns = new List<MetadataService.LayoutColumn>();
    MetadataService.LayoutColumn layoutColumn = new MetadataService.LayoutColumn();
    layoutColumn.layoutItems = new List<MetadataService.LayoutItem>();
   MetadataService.LayoutItem layoutItem1 = new MetadataService.LayoutItem();
      layoutItem1.behavior = 'Required';
      layoutItem1.field = 'Contact';
      layoutColumn.layoutItems.add(layoutItem1);
   layoutSection.layoutColumns.add(layoutColumn);
   layout.layoutSections.add(layoutSection);
   List<MetadataService.SaveResult> results =     
        service.createMetadata(
        new MetadataService.Metadata[] { layout });    
  System.debug(results[0].errors[0].message);
 
I get the error message as USER_DEBUG [106]|DEBUG|Layout must contain an item for required layout field: ContactId  .
I would be grateful if someone could help me solve this issue.

Thanks
Hi,

While creating page layout using metadata api
MetadataService.LayoutItem layoutItem9 = new MetadataService.LayoutItem();
    layoutItem9.behavior = 'Required';
    layoutItem9.field = 'Contact';
    layoutColumn.layoutItems.add(layoutItem9);

I am getting the error  Layout must contain an item for required layout field: ContactId . But I have included the required field COntact name using the above mentioned code. Please suggest a solution
Hi ,

I have a json file which has the custom field details like field name, field type , field values etc.. How do I write a code to create a custom field in salesforce from this external json file.
I got a exception ' System.CalloutException: Web service callout failed: Unable to parse callout response. Apex type not found for element displayLocationInDecimal '  while reading a geolocation custom field using metadata api.
Hi ,

I have a json file which has the custom field details like field name, field type , field values etc.. How do I write a code to create a custom field in salesforce from this external json file.