Posts

Showing posts with the label assign

Salesforce Fact #942 | PermissionSetLicenseAssign

Similar to PermissionSetAssignment, we have an Sobject PermissionSetLicenseAssign which keeps track of the assigned permission set licenses. The below query returns the list of PSLs assigned to the users: Select Id, PermissionSetLicense.DeveloperName, Assignee.Name FROM PermissionSetLicenseAssign Reference:  https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_permissionsetlicenseassign.htm

Salesforce Fact #765 | Assigning leads to territory using data load

Image
We can now assign Leads to territories. The same can be done using data load as well. For this, we need to import records in the ObjectTerritory2Association object and specify the Lead record Id in ObjectId field. Note: If you are using DataLoader and encounter an error 'Invalid Id', please update it to the latest version. Reference:  https://forceforfun.com/2022/10/25/update-dataloader-to-take-advantage-of-assigning-leads-to-territories/ Attached are the screenshots.

Salesforce Fact #709 | Assign PermissionSet in TestSetup()

Image
Suppose we need to test scenarios across multiple test methods in the context of a particular user and also a PS needs to be assigned to the user in order to gain access to required records. This is how we can create the user and assign the PS in TestSetup() method and in each test method we can fetch the user and use System.runAs(). Attached are the screenshots.