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
Krishna Prasad K PKrishna Prasad K P 

Hard coded Production Org Id in codes are updated on sandbox refresh!!

Hi,

 

I have few s-control and one Apex class where I have hardcoded the 15 char Production org Id in it. Intention for hardcoding the Prod Org Id can be found from the below logic.

 

 

IF (currentOrgId = Environments.PROD_ORG_ID){
    //handle it seriously
ELSE
   //handle it casually ;)

Now the problem is, each time when the sandboxes are refreshed, the Production org id stored in the public static variable PROD_ORG_ID will be overwritten with the org Id of that particular sandbox!!.Why!

 

WHY SFDC overwrites these values in the code ?And that too "without permission"!?

Sandbox org Id is readily available by UserInfo.getOrganizationId() call, then why the variables are updated.

I  couldn't find any document which mention about this Org Id update.

 

Any solution for masking the hardcoded orgId from being overwritten on sandbox refresh? please help me on this

 

Thanks,

Krishna

imuino2imuino2

I think you are missing one equal chat

 

If(currentOrgId == Enviroments.PROD_ORG_ID){

}else{

}

 

Otherwise, you are assigning the static value to the current org id variable, and thats always true.

 

Ignacio