A company uses the salesforce experience cloud to enable its marketing team in viewing and managing customer details. Divisions have been established within the marketing team, each requiring access to specific client information.
Currently, permission sets are employed to manage access to various customer details. As part of their ongoing enhancements, the salesforce product owner is planning to automate the assignment of permission sets through an apex program.
The automation of permission set assignments will be based on several factors currently under consideration by the business team. The Salesforce team has been tasked with conducting a proof of concept to dynamically assign permission sets to users.
Complete the given apex method to facilitate the addition of the specified permission set to the user.
Instructions:
1. The apex method must accept two parameters. The first parameter is the permission set name and the second parameter is the salesforce user record id.
2. Assign the permission set to the user record using standard permission set assignment object.
Example
//input
userAccessController.assignPermissionset(‘005XX’,’View_Customer_Info’);
//Result
The permission set ’View_Customer_Info’ is added to user record
Note: This exercise is designed to introduce you to writing an apex method to add a permission set to a user record. Focus on implementing the business requirements and learn more about permission set assignment object in salesforce. Feel free to validate your code by clicking the execute button.