You need to sign in to do that
Don't have an account?
SunkannaKuruva
Metadata API issue for add values to picklist
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
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............:)
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............:)
Please check if you have imported all the classes from the metadata sample to get this working.
Check this for all the classes in metadata sample and add them to your org
https://github.com/financialforcedev/apex-mdapi/tree/master/apex-mdapi/src/classes
Hope this helps you!
Please accept my solution as Best Answer if my reply was helpful. It will make it available for other as the proper solution.
Thanks and Regards
Sandhya