0

Context:

I have created a simple salesforce application with both standard and custom objects. Also i have created three different profiles for different permission levels. Now i want to package my application.

Query

  1. Can i package my profiles?
  2. What will happen when customer installs this package? Will these profiles be deployed to customer or not?
  3. If there is any problem in packaging profiles then how should i set user permissions to my objects in customer org?
  4. Can i change user permissions through Apex? How?

I would be grateful for your help. Thanks.

2

Q1 and Q2: Yes you can package your profiles, however you must ensure during installation of your package the user selects Security Configuration, here they must map your packaged profiles to those in their organisation. This is really important as it is a one time only operation. This must also be repeated during upgrades.

Q3: Yes customers can define profiles referencing your packaged objects, tabs, apex and visualforce pages manually. Though its not an easy task if they are unfamiliar with the structure of your app, also it can be quite a task if they have many many profiles.

Q4: You can read Permission Sets which reflect Profile information, but you cannot write to it, at least not from Apex directly. You can use the Salesforce Metadata API from Apex to deploy Profiles, though I would recommend another thought before thinking about this...

Permission Sets

I would strongly recommend you review this platform feature instead of using Profiles. These are the benefits of Permission Sets over Profiles.

  1. Permission Sets like Profiles express access to components in your package. However they are typically expressed in terms of functional modules in your application and not what you think might be roles in the target organisation (as has been historically the approach with Profiles).
  2. Permission Sets can be packaged and are upgradable.
  3. Permission Sets can be shared amongst users by assign them (new features in Spring'14 make this a lot easier). You can assign more than one Permission Set.
  4. Permission Sets can be assigned after installation.
  5. Permission Sets can be copied if the users want to modify yours.

Hope this helps!

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.