At DemandBlue, we provide On Demand Services for Salesforce development, customization, integrations, enhancements, and support to clients across various industries. In one of our recent projects, we came across a situation involving Salesforce Sandbox environment, where we were able to provide a solid resolution for our client. What I realized is that this is the kind of situation that any Salesforce development team working in Sandbox can encounter. I am sharing this knowledge with you in the hope that somebody somewhere finds it useful, and if that happens that would make my day!
Challenges in Salesforce Sandbox:
The client came to us to resolve a data refresh issue they were facing in Salesforce Sandbox environment. The client uses Sandbox environment (Org) for their production and this included multiple environments for the developer, QA, UAT, etc. They had to refresh the Sandbox often. When they refresh it, test data from Org gets erased. It takes 2-3 business days for them to export the data from production and import those data into Sandbox manually. As the frequency of refresh is often, the client wanted to generate test data for the objects after refreshing the Sandbox, so that they can start development immediately.
In order to populate the data automatically, client’s Salesforce developers had developed an apex class with predefined methods to populate the data for all predefined objects. The values were given statically in the methods. The values inserted through these methods would be assigned to respective objects.
The client realized that this workaround solution not only was temporary but also required a lot of manual intervention. They wanted to automate this process, to save time and release resources to focus on their development activities.
It was at this point they reached out to us for a permanent automated process. Our team assessed their existing environment and analyzed their requirements. Subsequently, we came up with a couple of solutions. One was to work with their existing code, which would retain most of their effort, but would be a complex process that may not be the best available solution. On the other hand, we suggested configuring the custom settings, which would meet all their requirements.
How we convinced the client:
The client was reluctant at first to go for option 2, so we demonstrated to the client how our solution would work. The solution was to configure custom settings in Salesforce Sandbox with the order of upload of CSV files for objects to be inserted and the primary key of the objects. We created an apex class, which would read the custom settings. When Sandbox is refreshed, Apex class will process the CSV file and insert the data into respective objects as per the custom settings.
For example, if we consider an Account object, the custom settings will contain object name, object API name, sequence of insertion and CSV file name. Apex class reads custom settings, process its CSV file, and insert it into Account object.
As per this approach, the client need not change any code. If any new object is to be added, they have to configure the custom settings and upload respective CSV file to a static resource in the production system. When Sandbox is refreshed, it will automatically populate the data of this object along with other objects.
Once the client understood that our proposed solution was dynamic, they readily agreed and gave the go-ahead for the project.
DemandBlue’s On Demand Services
DemandBlue is dedicated to transforming customer experiences by seamlessly transforming your Salesforce Sandbox environment. Our On Demand service team has experienced professionals focused on customer experiences, operational efficiency, and technology transformation to turn ideas into impact for your Organization. To find out more about how DemandBlue can help you transform your Salesforce Sandbox environment, Talk to our Team!
Authors: Indhu Ravi & Pavithra R, DemandBlue CoE