We use Skuid to build an application review process in a public-facing Portal (someday we’ll grow up and be big boys and girls in SF Communities – we’re not there yet). We seem not to be the only ones who find that Skuid’s auto-assignment of licenses and Page View Permissions isn’t effective for high volume SF licenses associates with portals and communities (e.g. Overage High Volume Customer Portal). Auto-assignment works fine for other SF licenses (internal staff), but not for external users.
So I’ve been approaching this from the apex side and nearly have a solution – I think the only thing getting in our way is our complicated coding environment tripping up my unit testing. But I’m not sure. Has anyone else taken this approach?
Trigger:
//For Skuid only, adds a free, unlimited Permission Set and License to all new Users. trigger SSA_Custom_User on User (after insert) { List<User> users= trigger.new; FOR(User u :users) { IF(u.ProfileId == '00e12000000RuwGAAS') { SSACustomUser.SkuidUserPermissions(u.Id); SSACustomUser.SkuidUserLicense(u.Id); } } }
Class:
public class SSACustomUser { @future public static void SkuidUserPermissions(String Id) { PermissionSet ps = mselect Id, Name from PermissionSet where Name = 'Skuid_Page_Viewer' limit 1]; PermissionSetAssignment psa = new PermissionSetAssignment (PermissionSetId = ps.Id, AssigneeId = Id); system.debug('user id is ' + Id); insert psa; } @future public static void SkuidUserLicense(String Id) { PackageLicense pl = aselect Id, NameSpacePrefix from PackageLicense where NameSpacePrefix = 'Skuid' limit 1]; UserPackageLicense upl = new UserPackageLicense (PackageLicenseId = pl.Id, UserId = Id); insert upl; } }