We know we could retrieve everything, parse it, insert the attribute and deploy, but that's a lot of work.
This option may not be a lot less work, but the open source build tool my team owns (CumulusCI) includes a framework we call "Metadata ETL" for automating exactly this type of change.
Metadata ETL tasks extract a specified subset of metadata from the org, ensuring that you have a deployable copy of the current state, makes targeted changes to the XML metadata based on your configuration, and then redeploys the entire package back into the org.
There isn't an out-of-the-box Metadata ETL task in CumulusCI to set the complianceGroup
facet, but we do have one to set the Help Text (inlineHelpText
) on fields. Modifying that task to target complianceGroup
instead would be a lot more straightforward than building a scripting solution from the beginning, and you wouldn't have to write any Xpath or XML parsing code since that's all handled for you.
The task's source code is on GitHub. What you'd need to do to adapt it would be:
- Install CumulusCI.
- Create a project with
cci project init
.
- Connect to your org (preferably a sandbox with
cci org connect --sandbox
).
- Copy the Python code above to
yourproject/tasks/compliance.py
.
- Revise the Python code to point at
complianceGroup
instead of inlineHelpText
.
- Add a new entry to
cumulusci.yml
, something like
tasks:
update_compliance_group:
class_path: tasks.compliance.UpdateComplianceGroup
options:
- api_name: Account.Description
compliance_group: PII
- api_name: Account.Website
compliance_group: PII
# and so on - depends on exactly how you tweaked the Task
And finally, run the task against the sandbox:
cci task run update_compliance_group --org mysandbox