{"action":"created","issue":{"url":"https://api.github.com/repos/financialforcedev/apex-mdapi/issues/134","repository_url":"https://api.github.com/repos/financialforcedev/apex-mdapi","labels_url":"https://api.github.com/repos/financialforcedev/apex-mdapi/issues/134/labels{/name}","comments_url":"https://api.github.com/repos/financialforcedev/apex-mdapi/issues/134/comments","events_url":"https://api.github.com/repos/financialforcedev/apex-mdapi/issues/134/events","html_url":"https://github.com/financialforcedev/apex-mdapi/issues/134","id":156950844,"number":134,"title":"FATAL_ERROR|navpeIIll.MetadataServiceExamples.MetadataServiceExamplesException: Error occured processing component navpeIIll__Fund__c-navpeIIll__Fund Layout. Invalid field:navpeIIll__Legal_Name__c in related list:navpeIIll__Fundraising__c.navpeIIll__Fund_Name__c (FIELD_INTEGRITY_EXCEPTION).","user":{"login":"LalitSingh","id":1655482,"avatar_url":"https://avatars.githubusercontent.com/u/1655482?v=3","gravatar_id":"","url":"https://api.github.com/users/LalitSingh","html_url":"https://github.com/LalitSingh","followers_url":"https://api.github.com/users/LalitSingh/followers","following_url":"https://api.github.com/users/LalitSingh/following{/other_user}","gists_url":"https://api.github.com/users/LalitSingh/gists{/gist_id}","starred_url":"https://api.github.com/users/LalitSingh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LalitSingh/subscriptions","organizations_url":"https://api.github.com/users/LalitSingh/orgs","repos_url":"https://api.github.com/users/LalitSingh/repos","events_url":"https://api.github.com/users/LalitSingh/events{/privacy}","received_events_url":"https://api.github.com/users/LalitSingh/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2016-05-26T10:17:03Z","updated_at":"2016-06-12T09:43:59Z","closed_at":"2016-06-12T09:43:59Z","body":"With the help of below code I am trying to update layout like remove related list. After using NameSpace in my ORG, I am facing this problem, earlier I were not using NameSpace in my ORG than code was running perfectly. \r\n\r\nI have a Fund__c object as a Parent and Fundraising__c as a child object. In my related list Fundraising__c I added custom field Legal_Name__c as a column. If I remove this custom field, code run perfectly.\r\n\r\nPlease find the code below.\r\n\r\nMetadataService.MetadataPort service = new MetadataService.MetadataPort();\r\n        service.SessionHeader = new MetadataService.SessionHeader_element();\r\n        service.SessionHeader.sessionId = UserInfo.getSessionId();\r\n        \r\n        MetadataService.Layout layout = (MetadataService.Layout)service.readMetadata('Layout',new String[] {'navpeIIll__Fund__c-navpeIIll__Fund Layout'}).getRecords()[0];\r\n        system.debug('layout==========='+layout);                     \r\n        List<MetadataService.RelatedListItem> lstMD= layout.relatedLists;\r\n        system.debug('lstMD==========='+lstMD);\r\n         \r\n        for(integer i=0;i<lstMD.size();i++){\r\n            MetadataService.RelatedListItem mdsR= lstMD[i];\r\n            system.debug('lstMD==========='+mdsR);\r\n            if(mdsR.relatedList== 'navpeIIll__Fundraising__c.navpeIIll__Fund__c'){\r\n                layout.relatedLists.remove(i);  \r\n                system.debug('layout====50======='+layout);\r\n            }            \r\n        }        \r\n        MetadataServiceExamples.handleSaveResults(service.updateMetadata(new MetadataService.Metadata[] { layout })[0]);  \r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/financialforcedev/apex-mdapi/issues/comments/225423456","html_url":"https://github.com/financialforcedev/apex-mdapi/issues/134#issuecomment-225423456","issue_url":"https://api.github.com/repos/financialforcedev/apex-mdapi/issues/134","id":225423456,"user":{"login":"afawcett","id":1167760,"avatar_url":"https://avatars.githubusercontent.com/u/1167760?v=3","gravatar_id":"","url":"https://api.github.com/users/afawcett","html_url":"https://github.com/afawcett","followers_url":"https://api.github.com/users/afawcett/followers","following_url":"https://api.github.com/users/afawcett/following{/other_user}","gists_url":"https://api.github.com/users/afawcett/gists{/gist_id}","starred_url":"https://api.github.com/users/afawcett/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/afawcett/subscriptions","organizations_url":"https://api.github.com/users/afawcett/orgs","repos_url":"https://api.github.com/users/afawcett/repos","events_url":"https://api.github.com/users/afawcett/events{/privacy}","received_events_url":"https://api.github.com/users/afawcett/received_events","type":"User","site_admin":false},"created_at":"2016-06-12T09:43:59Z","updated_at":"2016-06-12T09:43:59Z","body":"@LalitSingh let me know if the above helped and/or if you need more discussion. I'll close out this issue for now, but your still more than welcome to post back on it any time and we can re-open. Thanks!"}}
{"actor":{"display_login":"afawcett"}}