• jieves@kyrobros.com
  • NEWBIE
  • 5 Points
  • Member since 2006

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 5
    Replies
Hi All,

I am getting an error "/apex/Unauthorized" while attaching an image in Rich text box in a Public site. It is working fine in a VF page inside salesforce but not working in a public site. Please help me on this.

Thanks
Lakshman

Hi,

 

In the belowcode I am not getting how to input the RoleId of the User for which I am creating Person Account . In our customer Portal we have assigned Default role of user to Empty. But the above future call is throwing an error that 'Account Owner should have some role' and when I am passing some role to this 'UserRoleId' field it throwing again an error '

High Volume Portal Users cannot have a user role' can any one suggest what should I pass as UserRoleId in order to make my Future call working and the user can be cretesd with its personal account.

'

 

public with sharing class CustomUserSiteRegister{

public string fNAme{get; set;}
public String lastName{get; set;}
public String email{get; set;}
public String confirmEmail{get; set;}
public string country{get; set;}
public string state{get; set;}
public string city{get; set;}

public String communityNickname{get; set;}

public pagereference makeUserPersonAcc(){

recordType recType1 = [SELECT Name, SobjectType,IsPersonType FROM RecordType WHERE SobjectType='Account' AND developername = 'Person_Account' AND IsPersonType = true ];

Account personAcc= new Account();
personAcc.recordtype = recType1 ;
personAcc.firstName = fName;
personAcc.lastName = lastName;
personAcc.PersonEmail= email;
personAcc.BillingCountry = country;
personAcc.BillingState = state;
personAcc.BillingCity = city;

insert personAcc;
system.debug('this is peronAcc'+personAcc);

UserRole usrRole = [Select PortalAccountOwnerId,Name, PortalAccountId From UserRole limit 1];
system.debug('thi is usrRole'+ usrRole);

Profile p = [select id ,Name from profile where UserLicense.Name like '%Authenticated Website%' limit 1];
Profile p1 = [select id ,Name from profile where Name = 'Authenticated User'];

system.debug('this is profileName'+p1.Name);
Account getCon = [select id , PersonContactId from account where id =: personAcc.id];
system.debug('this is getCon'+personAcc.PersonContactId );

createUser(getCon.PersonContactId , personAcc.PersonEmail, personAcc.firstName, personAcc.lastName, Email ,(string)p1.id );

return null;}

// Setup nonSetup objects problem , so used @future.
@future static void createUser(id con, String email, String firstName, String lastName, String userName, String profileId ) {
Database.DMLOptions dmo = new Database.DMLOptions();
dmo.EmailHeader.triggerUserEmail = true;
system.Debug('I am here'+con);
system.Debug('I am here');
system.Debug('I am here'+email);
User u = new User(alias = 'standt', email=email,
emailencodingkey='UTF-8', lastname=lastname, languagelocalekey='en_US',
localesidkey='en_US', profileid = profileId, contactId=con,
timezonesidkey='America/Los_Angeles', username=username , UserRoleId = '');

u.setOptions(dmo);
insert u;
}

 

 

 

Hi All,

 

I've installed the chatter blacklist application and love it.  But I seem to get an error if I do 2 posts back to back that have filtered works.  I get: 

 

Error: Error: Feed item doesn't exist.

 

Anyone else have this issue or know of a fix?

 

Thanks!

  • June 02, 2011
  • Like
  • 0

for example I have this string LONG-08080-aSDDdd-001

how do I get the end of the string after the last "-" : note that 001 could also be 00000001, 0100000 etc.. so not only 3 chars long

Hi All,

 

I am trying to get visitors of a site to self-register as members using the customer portal. This is something I have done a few times now, but in this case is not working.

 

The logic I during self registration is as follows:

 

- create a user, user

- create an account of type person account

- insert the account

- change the account owner to a system admin with a role assigned

- update the account

- get the accountId

- make the following call --> ID userId = Site.createPortalUser(u, accountId, password);

 

The above call return userId=null, so that the customer portal user is not created.

 

I have tried to do "manually"what  the Site.createPortalUser call does internally and it works. What I have done is as follows:

 

- create a user, user

- create an account of type person account

- insert the account

- change the account owner to a system admin with a role assigned

- update the account

- get the accountId

- get the PersonContactId (since this is a Person Account)

- assiign  user.ContactId = PersonContactId

- assing user.profileId = (Id of the customer portal user profile)

- insert user

 

This gets me a valid userId and the person account is created and enabled for the customer portal okay.

 

On that basis I have tried again the call to  Site.createPortalUser but instead of the accountId tried passing the PersonContactId (since it is a person account) and this did not work.

 

Any ideas would be very much appreciated.

 

Thanks in advance