Automatize manual tasks after deployment of Salesf

2019-07-18 02:38发布

问题:

If you are ever were involved in deployment of Salesforce project or setting continuous integration for SF project, you should know that often after deployment of metadata components (classes, pages etc) you additionally need to do some manual tasks like populating custom setting values or setting field level security for profiles. There are a lot of such boring actions.

On my current project I again faced with it and I'm looking for ways how i can maximally automate it. For deploying the project to Org we use Jenkins + Git. So, I want that these post-deployment actions were executed, for instance, after each deploy (or on some other triggers).

Are there any plugins for Jenkins or other tools, scripts or approaches that can help me with it?

回答1:

You need to find a way to run Anonymous Apex from shell and use it as step in Jenkins build script. https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_anonymous_block.htm You can use Tooling API directly for examlple or find some libs for your preferred language. Or you can try this repo for Ant https://github.com/financialforcedev/df12-deployment-tools that has useful deployment scripts including ExecAnon or ExecAnonScript