I am trying to use the standard self-registration lightning component to get the capability for the external users to create a new user account in the community. On the Community's administration, I have already enabled : 'Allow external users to self-register', Chosen the Register community page, added my community profile and appended a temporary account.

Used the Lightning component: selfRegister on the Register community page. When I try to register with some test data, I am getting this error: Ending position out of bounds: -1 I didn't made any changes to any of the code in the Ltng component or controller class. What I am doing wrong here? Just trying to make use of OOB functionality which is not working.

Referred this doc:

  1. Salesforce Self-Registration

Screenshot: enter image description here

Some suggestions/references/workarounds would be really appreciated.

  • can you share a screenshot of your component settings? click on it in builder mode
    – glls
    Sep 24, 2017 at 6:01
  • Attached the screen for the component settings. Let me know if you need further info.
    – Arnold Jr.
    Sep 24, 2017 at 7:04

1 Answer 1


Alright folks, I couldn't get this issue resolved here. So in my research, I found this issue as a Salesforce Known Issue which was opened two weeks prior to my post.

As the fix was mentioned: SCHEDULED - SPRING '18, I have reached out to Salesforce to get this solved at least in my Org as this is a Standard functionality. Thanks to Salesforce, they guided me where to look and provided me with the code to fix it. Here it is:


Use Network.getLoginUrl(networkId) or Network.communitiesLanding() to fetch the community url and then use it in the code to pass on instead of the networkId

String commURL = Network.getLoginUrl(networkId);

if(networkId != null && siteAsContainerEnabled(commURL)) { 

Hope this helps someone who ran into this issue after Winter 18 release.

  • you changed your football team logo?
    – glls
    Sep 30, 2017 at 20:23
  • Haha I am in Washington Dc now. Lol. Dont know much how the redskins play, but wanted to have the regional feeling.
    – Arnold Jr.
    Sep 30, 2017 at 20:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.