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
Atif MohammedAtif Mohammed 

Getting error System.StringException: Invalid id: in site register controller

Hi,

 

I have removed the id from the site register controller class and it gives me an error while package and when i scan through secure code scanner of check mark it provides me an error free report.

 

 private static Id PORTAL_ACCOUNT_ID = '';----no error on security report but cant do packaging .

 

And when i add up the id in the site register controller its gives me an error in the checkmark report that the hardcoding of id is done.

 

 private static Id PORTAL_ACCOUNT_ID = 'a0VE0000005xSck';---error hardcoding of id is done and packaging can be done.

 

How do i resolve this issue.To get pass in the security review process.

 

 

 

bob_buzzardbob_buzzard
I'd put that account id into a custom setting. That way, when someone installs the package, they can put the id of their portal account in the setting.
Atif MohammedAtif Mohammed
I am getting error as it is not picking up any id of the page


I have done like this
public with sharing class SiteRegisterController {
public string accountId{set;get;}
public HRMS__Accountid__c acc;
accountId = ApexPages.currentPage().getParameters().get('id');
acc=[select id,HRMS__AccountID__c FROM HRMS__Accountid__c where id=:accountid];
public static Id PORTAL_ACCOUNT_ID=accountid;


but its giving me error
bob_buzzardbob_buzzard

That's not a custom setting - thats a URL parameter.