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
arc_08arc_08 

We are planning to Automate Custom settings update based on the org’s.

We are planning to  Automate Custom settings update based on the org’s. As of now , we are manually updating them .We want to store all custom settings data into Static resource then update it through Apex. How to do this?
AbhishekAbhishek (Salesforce Developers) 
Hi,

Salesforce introduced this as part of the winter '16 release ... as others told .. if it works .. I would like to go thru this route... thanks in advance.

global class sandbox implements SandboxPostCopy {

  global void runApexClass(SandboxContext context) {
      System.debug('Hello Tester Pester ' + context.organizationId()
           + ' ' + context.sandboxId() + context.sandboxName());
    }

  global static void run() { 
  
  
      if (context.sanboxname() = 'Dev')
      
      {
          customsettinngs.getOrgdefaults().Org = 'system.url.dev.com';

          I would like update more custom settings/labels like above ... 
          
      }

      if (context.sanboxname() = 'UAT')
      
      {
          customsettinngs.getOrgdefaults().Org = 'system.url.uat.com';

          I would like update more custom settings/labels like above ... 
          
      }

    if (context.sanboxname() = 'TEST')
      
      {
          customsettinngs.getOrgdefaults().Org = 'system.url.test.com';

          I would like update more custom settings/labels like above ... 
          
      }
}

Modify the code snippet if anything more needed.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.

Thanks.