• SunkannaKuruva
  • NEWBIE
  • 0 Points
  • Member since 2016
  • Sr Consultant
  • Capgemini India Pvt Ltd

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies
Hello
below the link for Metadataservice api class am using 
https://github.com/financialforcedev/apex-mdapi/blob/master/apex-mdapi/src/classes/MetadataService.cls

and the below code i wrote for value adding into picklist 
 
MetadataService.MetadataPort services = new MetadataService.MetadataPort();
		services.SessionHeader = new MetadataService.SessionHeader_element();
		services.SessionHeader.sessionId = UserInfo.getSessionId();
			

MetadataService.MetadataPort service = services;     
    MetadataService.CustomField customField = new MetadataService.CustomField();
    customField.fullName = 'case.BU__c';
    customField.label = 'picklist';
    customField.type_x = 'Picklist';


    metadataservice.Picklist pt = new metadataservice.Picklist();
    pt.sorted= false;
      metadataservice.PicklistValue two = new metadataservice.PicklistValue();
        two.fullName= 'second';
        two.default_x=false ;

        metadataservice.PicklistValue three = new metadataservice.PicklistValue();
        three.fullName= 'third';
        three.default_x=false ;
    pt.picklistValues = new list<metadataservice.PicklistValue>{two,three};
    customField.picklist = pt ;

   MetadataService.UpdateMetadata ut = new MetadataService.UpdateMetadata();
    ut.setmetadata= customField;
	ut.setcurrentName=('case.BU__c');
    MetadataService.AsyncResult[] results = service.updateMetadata(new List<MetadataService.updateMetadata> {customField});

but am getting below error 

Line: 25, Column: 44
Invalid type: MetadataService.UpdateMetadata

can you please help me some one on this .

Thanks in advance............:) 
 
I've created a trigger in the Case Object but it does not fires when my salesforce receive a case from a email to case ...
Is there a way to enable/disable the apex code triggers from outside rssources ?

does the Apex triggers works  with email to cases and webtocases and all this kind of external sources  ??

Thankx 

Miguel


Message Edited by Mig on 06-27-2008 04:57 PM
  • June 27, 2008
  • Like
  • 0