Can we assign particular record types to profiles using Apex? My scenario is , if we select profile and record type, then that record type is automatically assigned to that particular profile using apex.

I am getting profile and record type ID using the following SOQL queries,

[SELECT id,name,SObjectType from RecordType]
[SELECT Id,name FROM Profile]

but i can't update profile with record type.


You can use Financial Force's Metadata API Wrapper to access the metadata API. You'd need to use the Metadata API to assign record types to profiles, because this is not a normal type of metadata that you can update directly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.