+ Start a Discussion
abhishek_sf@hotmail.comabhishek_sf@hotmail.com 

How to create a profile using metadata api through apex class

Hi all

 

    I just want to create the profile using meta data api, but there are some hurdels 

 

I am able to create custom object using metadata api the sample code for that is

 

public static void createObject()
{
MetadataService.MetadataPort service = createService();
MetadataService.CustomObject customObject = new MetadataService.CustomObject();
customObject.fullName = 'Test__c';
customObject.label = 'Test';
customObject.pluralLabel = 'Tests';
MetadataService.AsyncResult[] results = service.create(new List<MetadataService.Metadata> { customObject });
}

 

In the similar manner i want to create profile using meta data api, if any one has anty idea then please give me the code

Sonam_SFDCSonam_SFDC

Hey Abhishek,

 

I found the following article on accessing  Profiles using Metadata API:

http://www.salesforce.com/us/developer/docs/api_meta/index_Left.htm#StartTopic=Content/meta_profile.htm

 

Hope this helps!

 

 

Deep067Deep067

Hi sonam 

 

    I have read that, but there are some confusion that how i can implement it, can u give an exmple of creating profile using apex metadata api

 

 

Thanks

Abhishek Tiwari