2

The use case here is that we want to import sandbox with test data having parent child relationship in a single go. One way to do it would be to use sf commands -

sf data import tree --plan Account-Contact-plan.json

Or if your project is configured using Cumulus CI, you can use Snowfakery to create dataset recipes and execute the cci task commands to load test data into sandbox/scratch org.

However, both of the above methods involve a developer running the commands in the CLI.

Is there any way I can have a button or a URL in my GitHub repo which can redirect the admin to org login page and post login, automatically run the necessary sf or cci commands

6
  • 2
    Is it too difficult to supply the user with a script to run the command?
    – Phil W
    Commented May 8 at 7:34
  • 2
    Or is it the having the tools installed that is the problem?
    – Phil W
    Commented May 8 at 7:39
  • @PhilW Its mainly the roadblocks of having the necessary tools installed and also the training associated with it
    – Aditya M
    Commented May 8 at 12:16
  • Tool install is a fair reason. Training no so much. "Double-click the script icon on the desktop" doesn't need a whole lot of training... regardless, is there also a question about the test data: should it always be the same? Or should users define their own?
    – Phil W
    Commented May 8 at 18:02
  • 1
    I would consider simply including a static resource will the required data description, and having the package/org include a specific screen flow, that can appear as a quick action on some screen, that invokes some apex that uses the content of the static resource to generate the required test data.
    – Phil W
    Commented May 9 at 12:33

1 Answer 1

1

Yes. You should be able to use a GitHub Action, such that a user with sufficient permissions can automatically log in and have the data populated. Integrations with Jenkins or Cumulus CI shouldn't involve the admin running scripts directly. You could create a Visualforce page/Lightning Component that they can navigate to in order to create the data. If they're using the Salesforce UI to create sandboxes, the SandboxPostCopy interface allows them to select a class to use. You could code something and have an integration hosted on Heroku or AWS EB for just a couple of dollars a month. Third-party programs like AutoRABIT and GearSet should be able to automate the process of creating all kinds of complicated record relationships at the click of a button.

Note: product/service names mentioned are not endorsements. Do your own research for product/service features before choosing a product/service.

5
  • +1 for github actions, using them on several of my projects, very convinient. Commented May 8 at 13:06
  • Unless you use a different git provider like Bitbucket. In which case it is Bitbucket pipelines that use the Salesforce CLI Docker image, with triggering of the pipeline through the Bitbucket UI.
    – Phil W
    Commented May 8 at 17:57
  • (Yes, the OP uses github)
    – Phil W
    Commented May 8 at 18:02
  • Just so that I am on the same page here, digging deeper into the GitHub action solution, we need to have a YML file setup which can authorize the org using JWT/SFDX Auth file and run the necessary sf data import commands. This file will run as part of CI/CD pipeline automatically or manually. Are you referring to this or am I completely off track here
    – Aditya M
    Commented May 9 at 7:40
  • @AdityaM Honestly, I haven't used GitHub Actions, but it sounds like you're on the right path.
    – sfdcfox
    Commented May 9 at 12:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .