function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Problem registering in a managed release package



It seems to work in a unmanaged package and throws this exception threw an email in  a managed release package:

Site registration accountId parameter value is not valid.


Here is the code we use:


private static String PORTAL_ACCOUNT_NAME = 'Customer portal';String userId = Site.createPortalUser(u, accountId, candidate.password__c);User u = new User(); u.Username = candidate.email__c; u.Email = 'sitep'+candidate.email__c; u.CommunityNickname = candidate.firstName__c + candidate.lastName__c; String accountId = [select id from Account where name=:PORTAL_ACCOUNT_NAME].id;

 Obviously we have previously created this Account.


I also checked the security settings in the Site profile but couldn't find any difference.


Coudl it be prefix related? 


We throw this message when either the accountId param is null or if we get null when we query for the owner of the account.

Thanks for the reply.


we have previously created this account. We also checked the request threw Apex explorer and it works fine.


The same works in a unmanaged package but not in a managed package. The problem is we don't have any way to debug. I'm pretty sure the id is not null (but not 100% as I don't have any debug) but maybe the request needs a prefix or the Account needs to be a special Account in a managed package....