Execute Apex code over Sandbox environment only, but have it on production as well 🔥 🔥
public Class Helloword
{
public void runlogicOnSandboxOnly()
{
Boolean isSandbox = IsrunningInASandbox();
if (isSandbox)
{
// code for Sandbox only
}
}
public Boolean IsrunningInASandbox() {
return [SELECT Id, IsSandbox FROM Organization LIMIT 1].IsSandbox;
}
}
Salesforce tutorials in Apex, Lightning Web Components, and Flow — plus honest career guidance for admins, developers, and job seekers trying to break into the ecosystem.
Wednesday, January 1, 2025
Execute Apex code over Sandbox environment only, but have it on production as we
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment