+ Start a Discussion
rupesh ranjanrupesh ranjan 

urgent

How can i get UserInfo.getOrganizationId() of particular orgID= 00D500000006n2CEAQ
CongnizentCongnizent
in visual force page use {!$Organization.Id}

in apex use String orgId = UserInfo.getOrganizationId();​

Please let me know detailed problem u have.
rupesh ranjanrupesh ranjan
I need to hardcode of particular organization ID 00D500000006n2CEAQ


public class CryptoTest {
        public CryptoTest (ApexPages.StandardController acon) { }
    String MySessionID = UserInfo.getSessionID();
    String conId = ApexPages.currentPage().getParameters().get('Id');
    String EmailCon=[Select email from Contact where Id=:conId ].email;
    String myurl= URL.getSalesforceBaseUrl().toExternalForm() + '/services/Soap/c/10.0/' + UserInfo.getOrganizationId();
    public String getFoo() {
    string c='eU9WzoFgU4n8Apu5PYxcNGRZswRDZJWDEMdbQVU85gw=';
    if(String.IsBlank(EmailCon)){ EmailCon='';}
    Blob cryptoKey= EncodingUtil.base64Decode(c);
    Blob data = Blob.valueOf(MySessionID );
    Blob data1 = Blob.valueOf(myurl);
    Blob data2 = Blob.valueOf(conId);
    Blob data3 = Blob.valueOf(EmailCon);
    
    Blob encryptedData = Crypto.encryptWithManagedIV('AES256', cryptoKey, data);
    Blob encryptedData1 = Crypto.encryptWithManagedIV('AES256', cryptoKey, data1);
    Blob encryptedData2 = Crypto.encryptWithManagedIV('AES256', cryptoKey, data2);
    Blob encryptedData3 = Crypto.encryptWithManagedIV('AES256', cryptoKey, data3 );
     
    String b64Data = EncodingUtil.base64Encode(encryptedData);
    String b64Data1 = EncodingUtil.base64Encode(encryptedData1);
    String b64Data2 = EncodingUtil.base64Encode(encryptedData2);
    String b64Data3 = EncodingUtil.base64Encode(encryptedData3);
    
    String testurl='sessionID='+EncodingUtil.urlEncode(b64Data, 'UTF-8')+'&serverUrl='+EncodingUtil.urlEncode(b64Data1, 'UTF-8')+'&contactID='+EncodingUtil.urlEncode(b64Data2, 'UTF-8')+'&email='+EncodingUtil.urlEncode(b64Data3, 'UTF-8');
        return testurl;
    }
}
rupesh ranjanrupesh ranjan
waiting for your reply @Congnizent